您的位置:首页 > 其它

洛谷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;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  洛谷