結果

問題 No.1198 お菓子配り-1
コンテスト
ユーザー Series_205
提出日時 2020-08-28 21:32:04
言語 C++17
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 2,000 ms
+ 795µs
コード長 1,040 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,390 ms
コンパイル使用メモリ 211,612 KB
実行使用メモリ 8,488 KB
最終ジャッジ日時 2026-10-19 19:38:20
合計ジャッジ時間 2,981 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge6_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) begin(x), end(x)
using namespace std;
using ll = long long;
constexpr ll Mod = 998244353;
constexpr ll mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;
const double PI = acos(-1);
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) {
    return a < b && (a = b, true);
}
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) {
    return a > b && (a = b, true);
}
/*-------------------------------------------*/

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    string s;
    cin >> s;
    if(s.back() + '0' & 1) {
        cout << (s == "1" ? -1 : 1) << endl;
        return 0;
    }

    if(s == "4") {
        cout << -1 << endl;
        return 0;
    }

    s = "00" + s;

    if(stoi(string(s.end() - 2, s.end())) % 4 == 0)
        cout << 1 << endl;
    else
        cout << -1 << endl;

    return 0;
}
0