結果
| 問題 |
No.80 四角形を描こう
|
| コンテスト | |
| ユーザー |
💕💖💞
|
| 提出日時 | 2017-07-22 16:46:07 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 1,280 ms / 5,000 ms |
| コード長 | 502 bytes |
| コンパイル時間 | 14,015 ms |
| コンパイル使用メモリ | 386,716 KB |
| 実行使用メモリ | 57,232 KB |
| 最終ジャッジ日時 | 2024-10-09 09:59:06 |
| 合計ジャッジ時間 | 16,417 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 8 |
コンパイルメッセージ
warning: unused import: `LinkedList`
--> src/main.rs:2:33
|
2 | use std::collections::{HashMap, LinkedList};
| ^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: unnecessary parentheses around `for` iterator expression
--> src/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
--> src/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`
--> src/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
ソースコード
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)
}
💕💖💞