結果
問題 | No.1198 お菓子配り-1 |
ユーザー |
|
提出日時 | 2023-10-06 21:10:01 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 760 bytes |
コンパイル時間 | 1,542 ms |
コンパイル使用メモリ | 169,064 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-26 15:35:13 |
合計ジャッジ時間 | 2,207 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 12 WA * 2 |
ソースコード
#include <bits/stdc++.h> using namespace std; //#include <atcoder/all> //using namespace atcoder; typedef long long ll; typedef unsigned long long ull; const int MAX = 1e9; const int MIN = -1*1e9; const ll MAXLL = 1e18; const ll MINLL = -1*1e18; //const ll MOD = 998244353; //const ll MOD = 1000000007; string EraseZero(string S) { while(S.size() != 1) { if(S[0] != '0') break; S = S.substr(1); } return S; } int main() { string S; cin >> S; if((S[S.size()-1] - '0')%2 != 0) { cout << 1 << endl; return 0; } reverse(S.begin(),S.end()); if(S.size() != 1) S = S.substr(0,2); reverse(S.begin(),S.end()); S = EraseZero(S); cout << (stoi(S)%4==0 ? 1: -1) << endl; return 0; }