結果
問題 | No.528 10^9と10^9+7と回文 |
ユーザー | Nasatame |
提出日時 | 2017-06-09 23:51:00 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,118 bytes |
コンパイル時間 | 659 ms |
コンパイル使用メモリ | 59,088 KB |
実行使用メモリ | 4,372 KB |
最終ジャッジ日時 | 2023-10-24 03:15:19 |
合計ジャッジ時間 | 1,761 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,348 KB |
testcase_01 | AC | 1 ms
4,348 KB |
testcase_02 | AC | 2 ms
4,348 KB |
testcase_03 | AC | 1 ms
4,348 KB |
testcase_04 | AC | 2 ms
4,348 KB |
testcase_05 | AC | 1 ms
4,348 KB |
testcase_06 | AC | 2 ms
4,348 KB |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | AC | 8 ms
4,348 KB |
ソースコード
#include <iostream> #include <algorithm> #include <string> using namespace std; using ll = unsigned long long int; ll mod0 = 1000000000; ll mod7 = 1000000007; int main(void){ string s; cin >> s; ll ans0 = 0,ans7 = 0,tmp0 = 9,tmp7 = 9; for(int i = 0; i < s.size()-1; i ++){ if(!(i%2) && i >= 2) tmp0 *= 10; if(!(i%2) && i >= 2) tmp7 *= 10; tmp0 %= mod0; tmp7 %= mod7; ans0 += tmp0; ans7 += tmp7; ans0 %= mod0; ans7 %= mod7; //cout << ans0 << endl; } for(int i = 0; i < (s.size()+1)/2; i++){ int a = min(s[i]-'0',s[s.size()-(i+1)]-'0'); if(i == 0){ tmp0 = a; tmp7 = a; }else{ a += 1; tmp0 *= a; tmp7 *= a; } tmp0 %= mod0; tmp7 %= mod7; } ans0 += tmp0; ans7 += tmp7; ans0 %= mod0; ans7 %= mod7; cout << ans0 << endl; cout << ans7 << endl; }