結果
| 問題 | No.356 円周上を回る3つの動点の一致 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2016-04-02 12:52:48 | 
| 言語 | Rust (1.83.0 + proconio) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 1,571 bytes | 
| コンパイル時間 | 16,335 ms | 
| コンパイル使用メモリ | 378,168 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-12-25 12:21:03 | 
| 合計ジャッジ時間 | 18,306 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 48 | 
コンパイルメッセージ
warning: unused import: `Write`
 --> src/main.rs:1:22
  |
1 | use std::io::{ self, Write };
  |                      ^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default
warning: unused imports: `max`, `min`
 --> src/main.rs:3:17
  |
3 | use std::cmp::{ min, max };
  |                 ^^^  ^^^
warning: unused import: `BinaryHeap`
 --> src/main.rs:4:25
  |
4 | use std::collections::{ BinaryHeap, VecDeque };
  |                         ^^^^^^^^^^
warning: unused macro definition: `trace`
 --> src/main.rs:6:14
  |
6 | macro_rules! trace {
  |              ^^^^^
  |
  = note: `#[warn(unused_macros)]` on by default
            
            ソースコード
use std::io::{ self, Write };
use std::str::FromStr;
use std::cmp::{ min, max };
use std::collections::{ BinaryHeap, VecDeque };
macro_rules! trace {
    ($var:expr) => ({
        let _ = writeln!(&mut std::io::stderr(), ">>> {} = {:?}", stringify!($var), $var);
    })
}
fn gcd(a:i64, b:i64) -> i64{
    if b==0 {
        a
    } else {
        gcd(b,a%b)
    }
}
fn main() {
  let mut sc = Scanner::new();
  let t1:i64=sc.cin();
  let t2:i64=sc.cin();
  let t3:i64=sc.cin();
  let n=gcd(t2*(t3-t1), t1*(t3-t2));
  let m=t1*t2*t3;
  let k=gcd(n,m);
  println!("{}/{}",m/k,n/k);
}
#[allow(dead_code)]
struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
#[allow(dead_code)]
impl Scanner {
    fn new() -> Scanner { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn reserve(&mut self) {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
    }
    fn cin<T: FromStr>(&mut self) -> T {
        self.reserve();
        match self.buffer.pop_front().unwrap().parse::<T>() {
            Ok(a) => a,
            Err(_) => panic!("parse err")
        }
    }
    fn get_char(&mut self) -> char {
        self.reserve();
        let head = self.buffer[0].chars().nth(0).unwrap();
        let tail = String::from( &self.buffer[0][1..] );
        if tail.len()>0 { self.buffer[0]=tail } else { self.buffer.pop_front(); }
        head
    }
}
            
            
            
        