谁懂啊!!

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

蒟蒻+1
by sujiuli @ 2023-09-28 13:48:23


可以减去'A'+1来得到答案 代码如下 ```c #define G getchar() main(){ char c;int a=1,b=1; while(!isalpha(c=G)); for(;isalpha(c);c=G)a*=c-'A'+1,a%=47; while(!isalpha(c=G)); for(;isalpha(c);c=G)b*=c-'A'+1,b%=47; if(a==b)puts("GO"); else puts("STAY"); } ```
by cat_lover1 @ 2023-09-28 13:50:20


人家是 Python
by wzj0829 @ 2023-09-28 13:52:57


@[cz_awa](/user/246331) 大佬代码好高深,看不懂...QwQ
by Nadim @ 2023-09-28 13:53:01


@[Nadim](/user/1092650) 把 ```python3 a_s = 0 b_s = 0 ``` 改成 ```python3 a_s = 1 b_s = 1 ```
by HearTheWindSing @ 2023-09-28 14:05:22


@[Nadim](/user/1092650) 提示一下,Python 的 `ord()` 函数可以返回字符的 ASCII/Unicode 码数值,如 `ord('a')=97`。
by jifbt @ 2023-09-28 14:38:43


@[HearTheWindSing](/user/177072) AC了,感谢!!本帖完
by Nadim @ 2023-10-01 12:01:28


|