結果
問題 | No.1559 Next Rational |
ユーザー |
👑 ![]() |
提出日時 | 2021-06-25 22:10:46 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 588 bytes |
コンパイル時間 | 677 ms |
コンパイル使用メモリ | 69,844 KB |
最終ジャッジ日時 | 2025-01-22 12:19:00 |
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 7 WA * 8 |
ソースコード
#include <iostream>#include <atcoder/modint>using namespace std;using ll = long long;using ull = unsigned long long;#define rep(i,n) for(int i=0; i<(n); i++)using mll = atcoder::static_modint<1000000007>;ull N;mll A,B,K;int main(){cin >> N;if(N >= 100000000) exit(0);{ int a,b,k; cin >> a >> b >> k; A=a; B=b; K=k; }for(ull i=1; i<N; i++){mll C = (B * B + K) / A;A = B; B = C;}cout << A.val() << "\n";return 0;}struct ios_do_not_sync{ios_do_not_sync(){ios::sync_with_stdio(false);cin.tie(nullptr);}} ios_do_not_sync_inst;