結果
| 問題 |
No.2785 四乗足す四の末尾の0
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-06-14 22:06:53 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 320 ms / 2,000 ms |
| コード長 | 462 bytes |
| コンパイル時間 | 2,729 ms |
| コンパイル使用メモリ | 244,152 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-14 22:06:59 |
| 合計ジャッジ時間 | 4,729 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll= long long;
int main(){
int t;
cin>>t;
while(t--){
ll n;
cin>>n;
if(n<0)n=-n;
if(n==1){
cout<<"Yes"<<endl;
cout<<0<<endl;
continue;
}
ll x=n*n-2*n+2,y=n*n+2*n+2;
int a=0,b=0;
while(x%2==0){
a++;
x/=2;
}
while(y%2==0){
a++;
y/=2;
}
while(x%5==0){
b++;
x/=5;
}
while(y%5==0){
b++;
y/=5;
}
cout<<"No"<<endl;
cout<<min(a,b)<<endl;
}
}