結果
問題 | No.1198 お菓子配り-1 |
ユーザー |
|
提出日時 | 2024-12-09 00:51:05 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 509 bytes |
コンパイル時間 | 1,823 ms |
コンパイル使用メモリ | 167,180 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-09 00:51:08 |
合計ジャッジ時間 | 2,254 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 14 |
ソースコード
#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 && (N > 1 || (N == 1 && last > 1))){cout << 1 << endl;}else{cout << -1 << endl;}return 0;}