結果
問題 | No.2785 四乗足す四の末尾の0 |
ユーザー |
![]() |
提出日時 | 2024-06-14 22:01:55 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 355 ms / 2,000 ms |
コード長 | 773 bytes |
コンパイル時間 | 4,274 ms |
コンパイル使用メモリ | 250,872 KB |
最終ジャッジ日時 | 2025-02-21 22:00:10 |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
#include <stdio.h> #include <bits/stdc++.h> #include <atcoder/all> using namespace atcoder; using mint = modint998244353; using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 1000000000000000001 int main(){ int t; cin>>t; rep(_,t){ long long n; cin>>n; n = abs(n); if(n==0){ cout<<"No"<<endl; cout<<0<<endl; } else if(n==1){ cout<<"Yes"<<endl; cout<<0<<endl; } else{ cout<<"No"<<endl; long long A = n*n+n*2+2; long long B = n*n-n*2+2; long long X = 0,Y = 0; while(A%2==0){ A/=2; X++; } while(B%2==0){ B/=2; X++; } while(A%5==0){ A/=5; Y++; } while(B%5==0){ B/=5; Y++; } cout<<min(X,Y)<<endl; } } return 0; }