結果
問題 |
No.1198 お菓子配り-1
|
ユーザー |
|
提出日時 | 2024-12-09 00:48:29 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 481 bytes |
コンパイル時間 | 1,636 ms |
コンパイル使用メモリ | 167,868 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-09 00:48:32 |
合計ジャッジ時間 | 2,606 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 12 WA * 2 |
ソースコード
#include <bits/stdc++.h> #include <iostream> #include <string> using namespace std; int main(){ int N; string S; cin >> S; N = S.size(); int last2 = stoi(S.substr(max(0, N-2), N)); int last = stoi(S.substr(max(0, N-1), N)); if (last2 % 4 == 0 && (N > 1 || (N == 1 && last > 4))){ cout << 1 << endl; }else if(last % 2 == 1 && last > 1){ cout << 1 << endl; }else{ cout << -1 << endl; } return 0; }