結果
問題 |
No.8015 アンチローリングハッシュ
|
ユーザー |
![]() |
提出日時 | 2015-06-29 01:23:22 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 500 bytes |
コンパイル時間 | 463 ms |
コンパイル使用メモリ | 62,328 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-07 21:05:04 |
合計ジャッジ時間 | 1,621 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 21 |
ソースコード
#include <iostream> #include <string> #include "assert.h" #include <fstream> #include <vector> using namespace std; int main(){ int a,b; cin >> a >> b; a %= b; vector<int> v(b+1, -1); int i = 0; long long c = 1; while(true){ if(v[c] < 0) v[c] = i; else break; c = (c*a)%b; i++; } int len = i+1; string s(len, 'a'); string t(len, 'a'); s[len-1-v[c]] = 'b'; s[len-1-i] = 'c'; t[len-1-i] = 'b'; t[len-1-v[c]] = 'c'; cout << s << endl; cout << t << endl; return 0; }