洛谷P1200 [USACO1.1]你的飞碟在这儿Your Ride Is Here
2016-07-08 16:36
399 查看
水题,直接计算就OK
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
char hxc[10],dwc[10];
int hxi[10]={0},dwi[10]={0},hxm=1,dwm=1;//如果是0,则终究是0,因为是乘起来
int main(){
cin>>hxc>>dwc; //用cin读入
for(int i=0;i<strlen(hxc);i++){
hxm*=(int)hxc[i]-'A'+1;//求得数字
//cout<<"hxs:"<<hxm;
}
//cout<<endl<<"hxs%%:"<<hxm%47;
for(int i=0;i<strlen(dwc);i++){
dwm*=(int)dwc[i]-'A'+1;
//cout<<"dws:"<<hxm;
}
if(hxm%47==dwm%47){
cout<<"GO";
}
else{
cout<<"STAY";
}
return 0;
}
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
char hxc[10],dwc[10];
int hxi[10]={0},dwi[10]={0},hxm=1,dwm=1;//如果是0,则终究是0,因为是乘起来
int main(){
cin>>hxc>>dwc; //用cin读入
for(int i=0;i<strlen(hxc);i++){
hxm*=(int)hxc[i]-'A'+1;//求得数字
//cout<<"hxs:"<<hxm;
}
//cout<<endl<<"hxs%%:"<<hxm%47;
for(int i=0;i<strlen(dwc);i++){
dwm*=(int)dwc[i]-'A'+1;
//cout<<"dws:"<<hxm;
}
if(hxm%47==dwm%47){
cout<<"GO";
}
else{
cout<<"STAY";
}
return 0;
}
相关文章推荐
- P1478
- P1035
- P1008 难度2.7
- 【题解】洛谷1164小A点菜
- 洛谷P1553 数字反转(升级版)
- 洛谷P1035 级数求和
- 10.1做题——洛谷P1433 吃奶酪
- 10.9做题——洛谷P1927防护伞
- 10.10做题——USACO1.2/洛谷1207双重回文数(Dual Palindromes)
- 洛谷P1196银河英雄传说
- 洛谷P1115最大子段和
- 洛谷1086/NOI题库1.13.38/NOIP2004普及组第2题 花生采摘
- 洛谷P1024/NOI题库7891(2.3)/NOIP2001提高组T1 一元三次方程求解
- NOIP2002提高组/洛谷P1031均分纸牌
- 洛谷1791/CODEVS1214线段覆盖
- 洛谷P1541/CODEVS1068 乌龟棋
- 洛谷P1020/CODEVS1044 导弹拦截(拦截导弹)
- CODEVS1048石子归并
- 洛谷 P1352 TYVJ P1052 CODEVS 1380 没有上司的舞会
- 【洛谷1025 数的划分】【搜索】