結果

問題 No.80 四角形を描こう
ユーザー 💕💖💞💕💖💞
提出日時 2017-07-22 16:46:07
言語 Rust
(1.77.0)
結果
AC  
実行時間 897 ms / 5,000 ms
コード長 502 bytes
コンパイル時間 3,010 ms
コンパイル使用メモリ 180,044 KB
実行使用メモリ 57,348 KB
最終ジャッジ日時 2024-04-17 15:55:28
合計ジャッジ時間 2,950 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 0 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 16 ms
5,376 KB
testcase_10 AC 53 ms
8,960 KB
testcase_11 AC 897 ms
57,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused import: `LinkedList`
 --> main.rs:2:33
  |
2 | use std::collections::{HashMap, LinkedList};
  |                                 ^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unnecessary parentheses around `for` iterator expression
 --> main.rs:9:12
  |
9 |   for i in (1..m/2+1) { 
  |            ^        ^
  |
  = note: `#[warn(unused_parens)]` on by default
help: remove these parentheses
  |
9 -   for i in (1..m/2+1) { 
9 +   for i in 1..m/2+1 { 
  |

warning: unnecessary parentheses around `for` iterator expression
  --> main.rs:10:14
   |
10 |     for j in (1..m/2+1-i) {
   |              ^          ^
   |
help: remove these parentheses
   |
10 -     for j in (1..m/2+1-i) {
10 +     for j in 1..m/2+1-i {
   |

warning: unused variable: `v`
  --> main.rs:17:10
   |
17 |   for (k,v) in map.iter() {
   |          ^ help: if this is intentional, prefix it with an underscore: `_v`
   |
   = note: `#[warn(unused_variables)]` on by default

warning: 4 warnings emitted

ソースコード

diff #

use std::io::{self, BufRead};
use std::collections::{HashMap, LinkedList};

fn main() {
  let stdin = io::stdin();
  let line = stdin.lock().lines().next().unwrap().unwrap();
  let m = line.parse::<i32>().unwrap();
  let mut map = HashMap::new(); 
  for i in (1..m/2+1) { 
    for j in (1..m/2+1-i) {
      if i + j <= m/2 { 
        map.entry(i*j).or_insert(i+j);
      }
    }
  }
  let mut max:i32 = 0;
  for (k,v) in map.iter() {
    if max < *k { 
      max = *k;
    }
  }
  println!("{}", max)
}
0