結果

問題 No.313 π
ユーザー ぴろずぴろず
提出日時 2015-12-06 01:39:56
言語 Java19
(openjdk 21)
結果
AC  
実行時間 267 ms / 5,000 ms
コード長 1,355 bytes
コンパイル時間 2,837 ms
コンパイル使用メモリ 81,848 KB
実行使用メモリ 61,172 KB
最終ジャッジ日時 2023-10-12 16:23:08
合計ジャッジ時間 13,115 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 254 ms
60,952 KB
testcase_01 AC 240 ms
59,056 KB
testcase_02 AC 252 ms
59,572 KB
testcase_03 AC 246 ms
61,172 KB
testcase_04 AC 240 ms
57,808 KB
testcase_05 AC 248 ms
60,116 KB
testcase_06 AC 249 ms
58,096 KB
testcase_07 AC 254 ms
60,732 KB
testcase_08 AC 257 ms
60,516 KB
testcase_09 AC 255 ms
59,872 KB
testcase_10 AC 245 ms
60,824 KB
testcase_11 AC 246 ms
59,504 KB
testcase_12 AC 260 ms
60,708 KB
testcase_13 AC 256 ms
59,876 KB
testcase_14 AC 260 ms
60,652 KB
testcase_15 AC 256 ms
60,100 KB
testcase_16 AC 250 ms
59,460 KB
testcase_17 AC 254 ms
60,204 KB
testcase_18 AC 259 ms
60,904 KB
testcase_19 AC 260 ms
60,420 KB
testcase_20 AC 255 ms
59,148 KB
testcase_21 AC 260 ms
59,352 KB
testcase_22 AC 254 ms
60,680 KB
testcase_23 AC 258 ms
59,664 KB
testcase_24 AC 256 ms
59,912 KB
testcase_25 AC 258 ms
60,188 KB
testcase_26 AC 267 ms
60,924 KB
testcase_27 AC 242 ms
59,244 KB
testcase_28 AC 256 ms
60,392 KB
testcase_29 AC 258 ms
60,516 KB
testcase_30 AC 254 ms
60,016 KB
testcase_31 AC 251 ms
60,140 KB
testcase_32 AC 254 ms
59,664 KB
testcase_33 AC 251 ms
60,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package no313;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;

public class Main {
	public static final int MAX = 200000;
	
	public static void main(String[] args) {
		solve();
	}
	
	public static void solve() {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String pi = s.substring(0, 1) + s.substring(2, s.length());
		long sum = 0;
		long weightedsum = 0;
		for(int i=0;i<=MAX;i++) {
			int d = pi.charAt(i) - '0';
			sum += d;
			weightedsum += d * (i+1);
		}
		long diff = sum - SUM;
		int index = (int) ((weightedsum - WEIGHTED_SUM) / diff - 1);
		int miss = pi.charAt(index) - '0';
		System.out.println(miss + " " + (miss + 10 - diff) % 10);
	}
	
	public static final long SUM = 899117;
	public static final long WEIGHTED_SUM = 89939722901L;
	public static void calc() {
		try {
			Scanner sc = new Scanner(new File("pi.txt"));
			sc.next();
			StringBuilder sb = new StringBuilder();
			sb.append("3");
			while(sb.length() <= MAX) {
				sb.append(sc.next());
			}
			String pi = sb.toString();
			long sum = 0;
			long weightedsum = 0;
			for(int i=0;i<=MAX;i++) {
				int d = pi.charAt(i) - '0';
				sum += d;
				weightedsum += d * (i+1);
			}
			System.out.println(sum);
			System.out.println(weightedsum);
			
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
		
	}

}
0