結果
問題 | No.1198 お菓子配り-1 |
ユーザー |
|
提出日時 | 2020-08-28 22:19:41 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 566 bytes |
コンパイル時間 | 1,463 ms |
コンパイル使用メモリ | 166,224 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-16 09:30:06 |
合計ジャッジ時間 | 2,129 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 14 |
ソースコード
#include <bits/stdc++.h> using namespace std; #include <math.h> #include <iomanip> template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } const int mod=1000000007; const int INF=1001001001; int main() { string S; cin>>S; int n=S.size(); int a=S[n-1]-'0'; if(n>1){a+=10*(S[n-2]-'0');} int b=S[n-1]-'0'; if(S=="1"||S=="4"){cout<<-1<<endl;} else if(a%4==0||b%2!=0){cout<<1<<endl;} else{cout<<-1<<endl;} return 0; }