# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
103576 | 2019-03-31T16:57:51 Z | kishtarn555 | Lun (COCI19_lun) | C++14 | 2 ms | 384 KB |
#include<iostream> #include<vector> #include<algorithm> #include<stack> using namespace std; int N; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >>N; char c; long long sum = 0; long long pos; long long last; for (int i = 0; i < N; i++) { cin >> c; if (c=='x') { pos = i; continue; } if (i+1==N) { last = c-'0'; continue; } if ( i%2!=N%2) { sum+=c-'0'; } else { // cout <<(int)((c-'0')*2)<<endl; sum+= ((c-'0')*2)/10; sum +=((c-'0')*2)%10; } } // cout << sum<< endl; if (pos +1==N) { sum*=9; cout<<sum%10; return 0; } // c // cout << last<<endl; for (int i = 0; i < 10; i ++) { long long ss = sum+i; if (pos %2!=N%2) { } else { cout << "!"; ss=sum + (2*i)/10+(2*i)%10; } if ((ss*9)%10==last) { cout << i;return 0; } } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Incorrect | 2 ms | 256 KB | Output isn't correct |
7 | Incorrect | 2 ms | 256 KB | Output isn't correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Incorrect | 2 ms | 384 KB | Output isn't correct |
10 | Correct | 2 ms | 256 KB | Output is correct |