結果
問題 | No.1559 Next Rational |
ユーザー |
👑 ![]() |
提出日時 | 2021-06-25 22:07:26 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 607 bytes |
コンパイル時間 | 730 ms |
コンパイル使用メモリ | 76,664 KB |
最終ジャッジ日時 | 2025-01-22 12:16:25 |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 7 WA * 8 |
ソースコード
#include <iostream>#include <vector>#include <map>#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;{ int a,b,k; cin >> a >> b >> k; A=a; B=b; K=k; }if(N >= 1000000) exit(0);rep(i,N-1){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;