結果
| 問題 |
No.1819 Mirrored 2
|
| コンテスト | |
| ユーザー |
Nachia
|
| 提出日時 | 2022-01-21 23:42:41 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 28 ms / 2,000 ms |
| コード長 | 837 bytes |
| コンパイル時間 | 667 ms |
| コンパイル使用メモリ | 74,756 KB |
| 最終ジャッジ日時 | 2025-01-27 14:35:43 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 26 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using i64 = long long;
using u64 = unsigned long long;
using i32 = int;
using u32 = unsigned int;
#define rep(i,n) for(int i=0; i<(n); i++)
u64 rev_int(u64 x){
string a = to_string(x);
reverse(a.begin(), a.end());
u64 ans = 0;
for(auto c : a) ans = ans * 10 + (c - '0');
return ans;
}
int main() {
u64 P,Q,x,y; cin >> P >> Q >> x >> y;
for(u64 i=1; i<10000000; i++){
u64 revans = Q * i + y;
if(revans % 10 == 0) continue;
if(rev_int(revans) % P != x) continue;
cout << rev_int(revans) << endl;
return 0;
}
return 0;
}
struct ios_do_not_sync{
ios_do_not_sync(){
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
}
} ios_do_not_sync_instance;
Nachia