結果

問題 No.2185 平方数の下6桁
ユーザー OnjoujiToki
提出日時 2023-01-13 22:09:27
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,457 bytes
コンパイル時間 1,208 ms
コンパイル使用メモリ 120,732 KB
最終ジャッジ日時 2025-02-10 02:37:23
ジャッジサーバーID
(参考情報)
judge3 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 36 WA * 1
権限があれば一括ダウンロードができます

ソースコード

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() & 1 and 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