結果
| 問題 |
No.2119 一般化百五減算
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-11-04 22:00:19 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 976 bytes |
| コンパイル時間 | 1,131 ms |
| コンパイル使用メモリ | 103,556 KB |
| 最終ジャッジ日時 | 2025-02-08 17:44:33 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 22 WA * 3 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:25:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
25 | scanf("%d %d", &N, &M);
| ~~~~~^~~~~~~~~~~~~~~~~
main.cpp:27:37: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
27 | for(int i = 0; i < M; ++i) scanf("%lld %lld", &B[i], &C[i]);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include<cstdio>
#include<cmath>
#include<iostream>
#include<string>
#include<cstring>
#include<set>
#include<stack>
#include<numeric>
#include<algorithm>
#include<atcoder/math>
using namespace std;
using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define rep2(i, a, b) for (int i = (int)a; i < (int)(b); ++i)
#define rrep2(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); --i)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using ll = long long;
// using mint = modint998244353;
// constexpr int inv_2 = 499122177;
int main(){
// cin.tie(nullptr);
// std::ios_base::sync_with_stdio(false);
int N, M;
scanf("%d %d", &N, &M);
vector<ll> B(M), C(M);
for(int i = 0; i < M; ++i) scanf("%lld %lld", &B[i], &C[i]);
auto [x, y] = crt(C, B);
if(!y || x > N) printf("NaN\n");
else printf("%lld\n", x);
return 0;
}