- 【GESP202409C++二级】数位之和
h
- 2025-1-12 16:20:38 @
#include<bits/stdc++.h> using namespace std; int n,x,y; int main(){ scanf("%d",&n); while(n--){ scanf("%d",&x); int sumn=0; for(int i=x;i>0;i=i/10){ sumn+=i%10; } if(sumn%7==0) printf("Yes\n"); else printf("No\n"); } return 0; }
2 comments
-
yeyouchen LV 7 @ 2025-1-12 16:23:59
#include<bits/stdc++.h> using namespace std; int n,x,y; int main(){ scanf("%d",&n); while(n--){ scanf("%d",&x); int sumn=0; for(int i=x;i>0;i=i/10){ sumn+=i%10; } if(sumn%7==0) printf("Yes\n"); else printf("No\n"); } return 0; }
-
2025-1-12 16:23:03@
#include<bits/stdc++.h> using namespace std; int main(){ int n,x; cin>>n; while(n--){ cin>>x; int y=x; int w=0; while(y>0){ w++; y/=10; } y=x; int sumn=0; while(y>0){ sumn+=pow(y%10,w); y/=10; } if(sumn==x) cout<<"T\n"; else cout<<"F\n"; } return 0; }
- 1
Information
- ID
- 2553
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 7
- Tags
- # Submissions
- 67
- Accepted
- 18
- Uploaded By