結果
問題 |
No.1198 お菓子配り-1
|
ユーザー |
|
提出日時 | 2020-12-12 15:34:41 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 555 bytes |
コンパイル時間 | 2,061 ms |
コンパイル使用メモリ | 192,980 KB |
最終ジャッジ日時 | 2025-01-16 22:55:45 |
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 14 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define REP(i,n) for(int i=0; i<(int)(n); i++) int main() { ios_base::sync_with_stdio(0); cin.tie(0); string n; cin >> n; bool ret = false;; if (n == "1" || n == "4") { ret = false; } else { int x = n.back() - '0'; n.pop_back(); if (n.size()) x += 10 * (n.back() - '0'); if (x % 2 != 0) ret = true; else if (x % 4 != 0) ret = false; else ret = true; } if (ret) cout << 1 << endl; else cout << -1 << endl; return 0; }