結果

問題 No.538 N.G.S.
ユーザー Shun_PIShun_PI
提出日時 2017-06-30 23:03:41
言語 Java21
(openjdk 21)
結果
AC  
実行時間 56 ms / 2,000 ms
コード長 2,100 bytes
コンパイル時間 3,987 ms
コンパイル使用メモリ 76,880 KB
実行使用メモリ 53,376 KB
最終ジャッジ日時 2023-10-25 04:31:02
合計ジャッジ時間 6,683 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
52,424 KB
testcase_01 AC 55 ms
53,336 KB
testcase_02 AC 54 ms
53,336 KB
testcase_03 AC 55 ms
53,352 KB
testcase_04 AC 54 ms
52,356 KB
testcase_05 AC 56 ms
53,352 KB
testcase_06 AC 54 ms
52,376 KB
testcase_07 AC 55 ms
53,352 KB
testcase_08 AC 56 ms
53,352 KB
testcase_09 AC 55 ms
53,340 KB
testcase_10 AC 54 ms
53,348 KB
testcase_11 AC 55 ms
53,348 KB
testcase_12 AC 55 ms
52,360 KB
testcase_13 AC 54 ms
52,352 KB
testcase_14 AC 54 ms
52,384 KB
testcase_15 AC 56 ms
53,348 KB
testcase_16 AC 54 ms
53,336 KB
testcase_17 AC 55 ms
53,336 KB
testcase_18 AC 54 ms
53,340 KB
testcase_19 AC 54 ms
53,348 KB
testcase_20 AC 54 ms
53,352 KB
testcase_21 AC 55 ms
53,348 KB
testcase_22 AC 55 ms
53,356 KB
testcase_23 AC 56 ms
53,348 KB
testcase_24 AC 56 ms
53,336 KB
testcase_25 AC 54 ms
53,348 KB
testcase_26 AC 53 ms
52,244 KB
testcase_27 AC 56 ms
52,416 KB
testcase_28 AC 56 ms
53,348 KB
testcase_29 AC 54 ms
53,352 KB
testcase_30 AC 53 ms
53,344 KB
testcase_31 AC 54 ms
53,336 KB
testcase_32 AC 53 ms
53,352 KB
testcase_33 AC 53 ms
53,348 KB
testcase_34 AC 54 ms
52,284 KB
testcase_35 AC 53 ms
53,352 KB
testcase_36 AC 53 ms
53,336 KB
testcase_37 AC 53 ms
53,292 KB
testcase_38 AC 54 ms
53,344 KB
testcase_39 AC 53 ms
53,340 KB
testcase_40 AC 55 ms
53,344 KB
testcase_41 AC 53 ms
51,304 KB
testcase_42 AC 54 ms
53,348 KB
testcase_43 AC 54 ms
53,352 KB
testcase_44 AC 54 ms
51,296 KB
testcase_45 AC 53 ms
51,304 KB
testcase_46 AC 56 ms
53,352 KB
testcase_47 AC 54 ms
53,336 KB
testcase_48 AC 54 ms
53,348 KB
testcase_49 AC 56 ms
52,268 KB
testcase_50 AC 54 ms
52,300 KB
testcase_51 AC 53 ms
52,236 KB
testcase_52 AC 54 ms
53,352 KB
testcase_53 AC 53 ms
53,376 KB
testcase_54 AC 53 ms
53,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;
 
public class Main {
	private static FastScanner sc = new FastScanner();
	
	public static void main(String[] args) {
		double b1 = sc.nextDouble();
		double b2 = sc.nextDouble();
		double b3 = sc.nextDouble();
		
		if(b2 == b1) {
			System.out.println(Math.round(b3));
			return;
		}
		
		double r = (b3 - b2) / (b2 - b1);

		System.out.println(Math.round(r * b3 + b2 - r * b1));
	}
	
	static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if(ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch(IOException e) {
                    e.printStackTrace();
                }
                if(buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
        public boolean hasNext() { skipUnprintable(); return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public int nextInt(){
            return Integer.parseInt(next());
        }
        public double nextDouble(){
            return Double.parseDouble(next());
        }
    }
}
0