結果
| 問題 |
No.338 アンケート機能
|
| コンテスト | |
| ユーザー |
rsk0315
|
| 提出日時 | 2019-01-08 18:58:54 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 384 bytes |
| コンパイル時間 | 152 ms |
| コンパイル使用メモリ | 28,288 KB |
| 最終ジャッジ日時 | 2025-01-06 20:13:27 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:14:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
14 | scanf("%d %d", &A, &B);
| ~~~~~^~~~~~~~~~~~~~~~~
ソースコード
#include <cstdio>
bool valid(int N, int A, int B) {
for (int i = 0; i <= N; ++i) {
int a = ((1000*i) / N + 5) / 10;
int b = ((1000*(N-i)) / N + 5) / 10;
if (A == a && B == b) return true;
}
return false;
}
int main() {
int A, B;
scanf("%d %d", &A, &B);
for (int i = 1; i <= 1000; ++i)
if (valid(i, A, B))
return !printf("%d\n", i);
return 1;
}
rsk0315