Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main(){
- string s;
- long long a;
- while(cin>>s){
- a=0;
- for(char i:s){
- a+=i-'0';
- }
- if(a%9==0) cout<<"konopad!\n"; else cout<<"konosuba!\n";
- }
- return 0;
- }
- /*
- Zero Judge g183. 81倍數判別
- https://zerojudge.tw/ShowProblem?problemid=g183
- 2024 May 27
- */
- /*
- //應該是下面的這邊才是對的
- #include <iostream>
- using namespace std;
- int main(){
- string s;
- long long a,t;
- while(cin>>s){
- a=0;
- t=1;
- for(int i=s.length()-1;i>=0;i--){
- a+=t*(s[i]-'0');
- t=(t*10)%81;
- }
- if(a%81==0) cout<<"konopad!\n"; else cout<<"konosuba!\n";
- }
- return 0;
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment