結果

問題 No.374 コイン
ユーザー megumishmegumish
提出日時 2016-06-04 23:32:52
言語 Rust
(1.77.0 + proconio)
結果
WA  
実行時間 -
コード長 1,596 bytes
コンパイル時間 12,875 ms
コンパイル使用メモリ 378,036 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-08 10:12:05
合計ジャッジ時間 14,005 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,248 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 1 ms
5,248 KB
testcase_08 AC 1 ms
5,248 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 1 ms
5,248 KB
testcase_12 AC 1 ms
5,248 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 1 ms
5,248 KB
testcase_18 AC 1 ms
5,248 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 1 ms
5,248 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 1 ms
5,248 KB
testcase_26 WA -
testcase_27 AC 1 ms
5,248 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused import: `std::str::Chars`
 --> src/main.rs:3:5
  |
3 | use std::str::Chars;
  |     ^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused import: `std::i32`
 --> src/main.rs:4:5
  |
4 | use std::i32;
  |     ^^^^^^^^

warning: unused import: `std::u8`
 --> src/main.rs:5:5
  |
5 | use std::u8;
  |     ^^^^^^^

warning: unused import: `std::ascii::AsciiExt`
 --> src/main.rs:7:5
  |
7 | use std::ascii::AsciiExt;
  |     ^^^^^^^^^^^^^^^^^^^^

warning: unused import: `std::collections::HashMap`
 --> src/main.rs:8:5
  |
8 | use std::collections::HashMap;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^

warning: unused import: `std::collections::HashSet`
 --> src/main.rs:9:5
  |
9 | use std::collections::HashSet;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^

warning: unused import: `std::collections::BTreeMap`
  --> src/main.rs:10:5
   |
10 | use std::collections::BTreeMap;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: unused import: `std::collections::BTreeSet`
  --> src/main.rs:11:5
   |
11 | use std::collections::BTreeSet;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: unused import: `std::collections::VecDeque`
  --> src/main.rs:12:5
   |
12 | use std::collections::VecDeque;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: unused import: `std::time::Duration`
  --> src/main.rs:14:5
   |
14 | use std::time::Duration;
   |     ^^^^^^^^^^^^^^^^^^^

warning: unused import: `std::cmp`
  --> src/main.rs:15:5
   |
15 | use std::cmp;
   |     ^^^^^^^^

warning: unused macro definition: `println_stderr`
  --> src/main.rs:17:14
   |
17 | macro_rules! println_stderr(
   |              ^^^^^^^^^^^^^^
   |
   = note: `#[warn(unused_macros)]` on by default

warning: unused macro definition: `print_stderr`
  --> src/main.rs:24:14
   |
24 | macro_rules! print_stderr(
   |              ^^^^^^^^^^^^

warning: use of deprecated trait `std::ascii::AsciiExt`: use inherent methods instead
 --> src/main.rs:7:17
  |
7 | use std::ascii::AsciiExt;
  |                 ^^^^^^^

ソースコード

diff #

use std::io;
use std::str::FromStr;
use std::str::Chars;
use std::i32;
use std::u8;
use std::f64;
use std::ascii::AsciiExt;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::BTreeMap;
use std::collections::BTreeSet;
use std::collections::VecDeque;
use std::io::prelude::*;
use std::time::Duration;
use std::cmp;

macro_rules! println_stderr(
    ($($arg:tt)*) => { {
        let r = writeln!(&mut ::std::io::stderr(), $($arg)*);
        r.expect("failed printing to stderr");
    } }
);

macro_rules! print_stderr(
    ($($arg:tt)*) => { {
        let r = write!(&mut ::std::io::stderr(), $($arg)*);
        r.expect("failed printing to stderr");
    } }
);

fn main() {
    let v = next_ints();
    let (mut a,b) : (f64,f64) = (v[0] as f64,v[1] as f64);
    let mut num = 0.0;
    while a >= b {
        num += (2.0_f64 * f64::consts::PI / f64::asin(b/(a-b))).trunc();
        a -= 2.0 * b;
    }
    println!("{}",match num as i64 {
        n if n % 2 == 0 => "K",
        _ => "S",
    })
}
#[allow(dead_code)]
fn next_string() -> String {
    let mut input = String::new();
    io::stdin().read_line(&mut input).unwrap();
    input
}

#[allow(dead_code)]
fn next_strings() -> Vec<String> {
    let input = next_string();
    input.split_whitespace().map(|x| x.parse().unwrap()).collect()
}

#[allow(dead_code)]
fn next_int() -> i64 {
    let input = next_string();
    i64::from_str(input.trim()).unwrap()
}

#[allow(dead_code)]
fn next_ints() -> Vec<i64> {
    let input = next_string();
    input.split_whitespace().map(|x| x.parse().unwrap()).collect()
}
0