結果

問題 No.2185 平方数の下6桁
ユーザー 👑 OnjoujiTokiOnjoujiToki
提出日時 2023-01-13 22:05:59
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,402 bytes
コンパイル時間 1,061 ms
コンパイル使用メモリ 124,456 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-26 03:51:12
合計ジャッジ時間 2,903 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 1 ms
4,380 KB
testcase_26 WA -
testcase_27 AC 1 ms
4,376 KB
testcase_28 AC 2 ms
4,380 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 1 ms
4,380 KB
testcase_31 AC 2 ms
4,380 KB
testcase_32 AC 1 ms
4,380 KB
testcase_33 AC 1 ms
4,376 KB
testcase_34 AC 1 ms
4,380 KB
testcase_35 AC 2 ms
4,380 KB
testcase_36 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <array>
#include <bit>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstring>
#include <ctime>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>

void solve() {
  std::string s;
  std::cin >> s;
  std::vector<int> a(s.size());
  for (int i = 0; i < 6; i++) {
    a[i] = s[i] - '0';
  }
  auto f = [&]() {
    if (a.back() == 2 or a.back() == 3 or a.back() == 7 or a.back() == 8)
      return false;
    if (a.back() & 1) {
      if (a[4] & 1) return false;
    }
    if (a.back() == 6 and a[4] % 2 == 0) return false;
    if (a.back() == 5 and a[4] != 2) return false;
    int cnt = 0;
    for (int i = 5; i >= 0; i--) {
      if (a[i] == 0)
        cnt++;
      else
        break;
    }
    if (cnt & 1) return false;
    if (a.back() == 1 or a.back() == 4 or a.back() == 9) {
      if (a[4] & 1) return false;
    }
    if (a[4] & 1) {
      if (a.back() != 6) return false;
    }
    return true;
  };
  if (f()) {
    std::cout << "YES\n";
  } else {
    std::cout << "NO\n";
  }
}
int main() {
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  std::cout << std::boolalpha;
  int t = 1;
  // std::cin >> t;

  while (t--) solve();
  // solve();
  return 0;
}
0