結果

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

テストケース

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

ソースコード

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