20求调

B3850 [GESP202306 四级] 幸运数

~~服务访问蜂窝范围~~ 帮你改好了,可$ AC $. ~~注释里写了东西~~ ```cpp #include<bits/stdc++.h> using namespace std; int n; char a[25]; int pd(int y){//判断一个数的各个数位之和,你之前的判断我看不懂 int tot=0; while(y){ tot+=y%10; y/=10; } if(tot>9){ return pd(tot); } return tot; } signed main(){ cin>>n; for(int i=1;i<=n;i++){ cin>>a; int s=strlen(a); for(int j=0;j<s;j++){ //如果这个数有偶数个位 e.g:878787878787 //奇数位的索引就是奇数 if(s%2==0){ if(j%2==0){ continue; } } //如果只有奇数个位e.g.16347 //奇数位索引是偶数 if(s%2==1){ if(j%2==1){ continue; } } int x=a[j]-'0'; x*=7;//直接改就可以了,没必要再做判断 int u=pd(x); a[j]=u+'0'; } int ans=0; for(int j=0;j<s;j++){ ans+=a[j]-'0';//加它的数字 } if(ans%8==0){ cout<<'T'<<endl; } else{ cout<<'F'<<endl; } } return 0; } ```
by liukelin @ 2024-04-23 20:49:45


@[The_second_coming](/user/976405) 这不林子凌吗
by fantasticJimmy @ 2024-04-25 18:16:12


@[fantasticJimmy](/user/977425) 不是
by The_second_coming @ 2024-04-27 09:19:54


此帖结
by The_second_coming @ 2024-04-27 09:20:44


消愁lzl
by fantasticJimmy @ 2024-04-28 18:34:13


|