50分。。。help!(c++)

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

[delete]喜乐[/delete]多想想233
by fcoaxt @ 2015-09-08 22:05:10


= =你两次都用的数组a, 只要长度一样输出都是GO 好吧
by 月与海 @ 2015-09-08 22:41:44


用string会怎样?
by Megumi_Cold @ 2015-09-09 21:19:12


不知行不行 ```cpp #include<stdio.h> #include<string.h> int main() {char a[7],b[7]; int i,j,c,d; long long s=1,e=1; gets(a); gets(b); i=strlen(a); j=strlen(b); for(c=0;c<i;c++) s=s*(a[c]-64); for(d=0;d<j;d++) e=e*(b[d]-64); s=s%47;e=e%47; if(s==e)printf("GO"); else printf("STAY"); return 0; } ```
by Megumi_Cold @ 2015-09-09 21:20:06


```cpp #include<iostream> #include<cstdio> using namespace std; char u[10],p[10]; int main() { long long a=1,b=1,c=0,d=0; for(int i=0;u[i-1]!='\n';i++) {u[i]=getchar();c++;} for(int i=0;p[i-1]!='\n';i++) {p[i]=getchar();d++;} for(int i=0;i<c-1;i++) a*=u[i]-64; for(int i=0;i<d-1;i++) b*=p[i]-64; a%=47;b%=47; if(a==b)cout<<"GO"; else cout<<"STAY"; return 0; } ```
by fluency_code @ 2015-10-27 20:53:26


Vm14amQyVkhUWGxTYkdoVVYwZDRVRlpxU205WlZsSllZM3BHYTAxVk5WZFpWVlUxWVZaSmQwNVdjRmRpVkVVd1dWWmtTMVpyTlZsVWJGWlhUVEJLUkZaVldrWlBWa0pTVUZRd1BRPT0=
by problem_ @ 2021-12-30 18:33:20


|