結果
| 問題 |
No.313 π
|
| コンテスト | |
| ユーザー |
konjo_p
|
| 提出日時 | 2015-12-07 01:00:05 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 35 ms / 5,000 ms |
| コード長 | 657 bytes |
| コンパイル時間 | 464 ms |
| コンパイル使用メモリ | 58,688 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-14 17:11:15 |
| 合計ジャッジ時間 | 2,310 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 32 |
ソースコード
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
typedef long long ll;
//const ll correct = 2122389473;
const ll correct = 1590773764;
ll p = (1LL << 31) -1;
//ll b = (1LL << 19) -1;
ll b = 1e9+7;
int main() {
string s;
ll hash = 0;
cin >> s;
for(int i = s.size()-1; i >= 0; i--) {
if(s[i] != '.')
hash = (hash * b + s[i]-'0') % p;
}
ll a = 1;
for(int i = 0; i < s.size(); i++) {
if(s[i] != '.') {
ll tmp = (hash - (s[i]-'0') * a + p) % p;
for(int j = 0; j < 10; j++) {
if(correct == (tmp + j * a) % p) {
cout << s[i] << " " << j << endl;
return 0;
}
}
a = (a * b) % p;
}
}
}
konjo_p