为什么只有“100分”!!??

P1200 [USACO1.1] 你的飞碟在这儿 Your Ride Is Here

```cpp #include <iostream> #include <cstring> using namespace std; char a[10005]; char b[10005]; int ansa=1; int ansb=1; int main() { cin>>a>>b; for(int i=0;i<strlen(a);i++) ansa*=(int)a[i]-64; for(int i=0;i<strlen(b);i++) ansb*=(int)b[i]-64; if(ansa%47==ansb%47) cout<<"GO"; else cout<<"STAY"; } ```
by Administrator2004 @ 2017-08-14 09:39:08


@[wdy743418310](/space/show?uid=38712) 用char吧
by Administrator2004 @ 2017-08-14 09:39:46


```cpp //minamoto #include<iostream> #include<cstdio> using namespace std; int main() { char a[6],b[6]; int m=0,n=0,i,j,s1,s2; while((a[m]=getchar())!='\n') m++; while((b[n]=getchar())!='\n') n++; s1=1; s2=1; for(i=0;i<m;i++) s1*=(a[i]-'A'+1); s1%=47; for(j=0;j<n;j++) s2*=(b[j]-'A'+1); s2%=47; if(s1==s2) cout<<"GO"; else cout<<"STAY"; } @[wdy743418310](/space/show?uid=38712) ```
by bztMinamoto @ 2017-08-14 09:45:33


@[Administrator2004](/space/show?uid=41421) 好吧,我试试
by wdy743418310 @ 2017-08-14 11:47:48


@[Administrator2004](/space/show?uid=41421) 膜拜鶸
by OOmega @ 2017-08-16 21:50:19


如果到最后再取模,有可能会炸吧。每乘一次取一下模?
by 窗边的小豆 @ 2017-08-17 21:42:41


可以用unsigned long long嘛
by 宇智波佐小助 @ 2017-08-27 16:13:14


@[宇智波——](/space/show?uid=55186) 最多才308915776 int型就够了 @[窗边的小豆](/space/show?uid=52979) 必须到最后才取模,不然会WA
by 名侦探柯北 @ 2017-08-28 10:39:15


@[名侦探柯北](/space/show?uid=55138) 嗯嗯,我习惯在内存不超的情况下开大点(无脑做题)
by 宇智波佐小助 @ 2017-08-28 11:43:35


@[宇智波——](/space/show?uid=55186) 额,那也不用这么大呀,long long不就很大了么
by 名侦探柯北 @ 2017-08-28 11:48:13


| 下一页