結果
問題 | No.1198 お菓子配り-1 |
ユーザー |
|
提出日時 | 2020-09-04 14:48:54 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 570 bytes |
コンパイル時間 | 1,509 ms |
コンパイル使用メモリ | 167,208 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-25 11:25:34 |
合計ジャッジ時間 | 2,301 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 14 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;const ll mod = 1000000007;const int INF = 1001001001;int main(){string s; cin >> s;reverse(s.begin(), s.end());int sz = s.size();if(sz == 1){int k = s[0] - '0';if(k == 4 || k == 1) cout << -1 << endl;else if(k == 8 || k % 2 == 1) cout << 1 << endl;else cout << -1 << endl;}if(sz >= 2){int k = (s[0] - '0') + 10 * (s[1] - '0');if(k % 4 == 0 || k % 2 == 1) cout << 1 << endl;else cout << -1 << endl;}}