結果
| 問題 |
No.747 循環小数N桁目 Hard
|
| コンテスト | |
| ユーザー |
ngtkana
|
| 提出日時 | 2020-04-01 23:21:05 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 619 bytes |
| コンパイル時間 | 2,878 ms |
| コンパイル使用メモリ | 192,740 KB |
| 最終ジャッジ日時 | 2025-01-09 12:24:37 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 120 |
ソースコード
#include<bits/stdc++.h>
using lint=long long;
using real=long double;
int main(){
std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
std::cout.setf(std::ios_base::fixed);std::cout.precision(15);
std::string s,t;std::cin>>s>>t;
lint a=std::accumulate(s.begin(),s.end(),0ll,[](lint cum,char c){return cum+c-'0';})%3;
lint b=(s.back()-'0')%2;
lint n=0;
for(;n<6;n++){
if(n%3==a&&n%2==b)break;
}
assert(0<=n&&n<6);
if((t.back()-'0')%2==0){
if(n==2)n=4;
if(n==5)n=1;
}
std::cout<<"428571"[n]<<'\n';
}
/*
* 0
* 1
* 2 4
* 3
* 4
* 5 1
*/
ngtkana