結果
問題 |
No.338 アンケート機能
|
ユーザー |
|
提出日時 | 2018-10-13 21:56:31 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 761 bytes |
コンパイル時間 | 27,834 ms |
コンパイル使用メモリ | 402,304 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-12 18:12:34 |
合計ジャッジ時間 | 14,032 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
#![allow(non_snake_case)] use std::io::{ self, prelude::* }; macro_rules! pick { ($tokens:expr) => { $tokens.next().unwrap().parse().expect("parse error") } } fn main() { let mut s = String::new(); io::stdin().read_to_string(&mut s).expect("i/o error"); let mut tokens = s.split_whitespace(); let A: i64 = pick!(tokens); let B: i64 = pick!(tokens); for m in 1.. { let a_min = m*(10*A-5) / 1000; let a_max = m*(10*A+5) / 1000; for a in a_min..=a_max { let b = m - a; if m*(10*A-5) <= 1000*a && 1000*a < m*(10*A+5) && m*(10*B-5) <= 1000*b && 1000*b < m*(10*B+5) { println!("{}", m); return; } } } }