結果
| 問題 |
No.747 循環小数N桁目 Hard
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-11-12 23:28:56 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 6 ms / 2,000 ms |
| コード長 | 288 bytes |
| コンパイル時間 | 1,578 ms |
| コンパイル使用メモリ | 166,736 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-22 19:49:17 |
| 合計ジャッジ時間 | 5,732 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 120 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int s[] = {2, 8, 5, 7, 1, 4};
int main() {
string a, b;
cin >> a >> b;
int x = 0;
for ( char c:a ) {
x = (x * 10 + (c - '0')) % 6;
}
if ( (b.back() - '0')%2==0 ) x = x * x % 6;
cout << s[(x + 5) % 6] << '\n';
return 0;
}