結果
| 問題 | No.661 ハローキティはりんご3個分 | 
| コンテスト | |
| ユーザー |  hitoyozake | 
| 提出日時 | 2018-04-14 00:01:19 | 
| 言語 | Rust (1.83.0 + proconio) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 1 ms / 2,000 ms | 
| コード長 | 1,777 bytes | 
| コンパイル時間 | 14,181 ms | 
| コンパイル使用メモリ | 403,404 KB | 
| 実行使用メモリ | 6,940 KB | 
| 最終ジャッジ日時 | 2024-06-26 21:59:40 | 
| 合計ジャッジ時間 | 14,886 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 5 | 
コンパイルメッセージ
warning: unused import: `std::str::*`
 --> src/main.rs:2:5
  |
2 | use std::str::*;
  |     ^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default
warning: unused import: `Read`
 --> src/main.rs:3:21
  |
3 | use std::io::{self, Read};
  |                     ^^^^
warning: unnecessary parentheses around type
 --> src/main.rs:5:24
  |
5 | fn getline() -> Result<(String)> {
  |                        ^      ^
  |
  = note: `#[warn(unused_parens)]` on by default
help: remove these parentheses
  |
5 - fn getline() -> Result<(String)> {
5 + fn getline() -> Result<String> {
  |
warning: unnecessary parentheses around function argument
  --> src/main.rs:10:8
   |
10 |     Ok((buffer))
   |        ^      ^
   |
help: remove these parentheses
   |
10 -     Ok((buffer))
10 +     Ok(buffer)
   |
warning: unused variable: `x`
 --> src/main.rs:8:9
  |
8 |     let x = io::stdin().read_line(&mut buffer)?;
  |         ^ help: if this is intentional, prefix it with an underscore: `_x`
  |
  = note: `#[warn(unused_variables)]` on by default
warning: unused variable: `a`
  --> src/main.rs:20:21
   |
20 |             let mut a = "";  
   |                     ^ help: if this is intentional, prefix it with an underscore: `_a`
warning: unused variable: `i`
  --> src/main.rs:21:17
   |
21 |             for i in 0..m{
   |                 ^ help: if this is intentional, prefix it with an underscore: `_i`
warning: unused variable: `err`
  --> src/main.rs:42:25
   |
42 |                     Err(err) =>{},
   |                         ^^^ help: if this is intentional, prefix it with an underscore: `_err`
warning: unused variable: `err`
  --> src/main.rs:49:13
   |
49 |         Err(err)=>{},
   |             ^^^ help: if this is intentional, prefix it with an underscore: `_err`
warning: variable does not need to be mutable
  --> src/main.rs:20:17
   |
20 |             let mut a = "";  
   |                 ----^
   |                 |
   |                 help: remove this `
            
            ソースコード
use std::io::*;
use std::str::*;
use std::io::{self, Read};
fn getline() -> Result<(String)> {
    let mut buffer = String::new();
    // ? はtry!の糖衣構文
    let x = io::stdin().read_line(&mut buffer)?;
    //println!("{}", x); // xは入力byte数
    Ok((buffer))
}
fn main() {
    let n = getline();
    let mut vec = Vec::new(); 
    match n {
        Ok(buf) => {
            
            let m :u32 = buf.trim().parse::<u32>().unwrap();
            let mut a = "";  
            for i in 0..m{
                let apples = getline();
                match apples{
                    Ok(b) => {
                      let apple_n = (b.trim().parse::<u32>().unwrap())/3; 
                      let row = b.trim().parse::<u32>().unwrap();
                        if row%8 ==0&& row%10==0{
                          vec.push("ikisugi".to_string());
                        }
                        else if row % 8 == 0 {
                            vec.push("iki".to_string());
                        }
                        else if row%10==0{
                            vec.push("sugi".to_string());
                        }
                        else {
                        
                            vec.push(apple_n.to_string());
                        }
                    }
                    Err(err) =>{},
        
                }
            }
        
        }
        Err(err)=>{},
    }
    for i in vec{
        println!("{}", i);
    }
    /*
    let n = getline();
    match n {
        Ok(buf) => {
            println!("input is {}", buf);
            let sp = buf.split(" ");
            for s in sp{
               println!("{}", s);
            }
        }
        Err(error) => println!("error is {}", error),
    }*/
}
            
            
            
        