結果

問題 No.1233 割り切れない気持ち
ユーザー 37zigen37zigen
提出日時 2020-09-21 06:02:35
言語 Java21
(openjdk 21)
結果
AC  
実行時間 784 ms / 3,153 ms
コード長 722 bytes
コンパイル時間 2,610 ms
コンパイル使用メモリ 74,296 KB
実行使用メモリ 68,620 KB
最終ジャッジ日時 2023-09-06 16:55:26
合計ジャッジ時間 26,478 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 138 ms
57,788 KB
testcase_01 AC 131 ms
58,204 KB
testcase_02 AC 149 ms
58,048 KB
testcase_03 AC 203 ms
58,808 KB
testcase_04 AC 199 ms
58,868 KB
testcase_05 AC 147 ms
57,768 KB
testcase_06 AC 150 ms
58,348 KB
testcase_07 AC 449 ms
62,536 KB
testcase_08 AC 496 ms
62,480 KB
testcase_09 AC 660 ms
66,512 KB
testcase_10 AC 657 ms
66,576 KB
testcase_11 AC 402 ms
62,372 KB
testcase_12 AC 762 ms
66,628 KB
testcase_13 AC 759 ms
66,720 KB
testcase_14 AC 784 ms
68,620 KB
testcase_15 AC 713 ms
66,548 KB
testcase_16 AC 728 ms
67,016 KB
testcase_17 AC 601 ms
66,812 KB
testcase_18 AC 669 ms
67,040 KB
testcase_19 AC 694 ms
66,836 KB
testcase_20 AC 605 ms
67,212 KB
testcase_21 AC 615 ms
66,648 KB
testcase_22 AC 619 ms
67,040 KB
testcase_23 AC 619 ms
66,744 KB
testcase_24 AC 665 ms
66,664 KB
testcase_25 AC 682 ms
67,736 KB
testcase_26 AC 637 ms
65,764 KB
testcase_27 AC 648 ms
66,908 KB
testcase_28 AC 633 ms
66,596 KB
testcase_29 AC 623 ms
66,892 KB
testcase_30 AC 621 ms
66,648 KB
testcase_31 AC 622 ms
66,616 KB
testcase_32 AC 620 ms
66,580 KB
testcase_33 AC 623 ms
64,796 KB
testcase_34 AC 635 ms
66,644 KB
testcase_35 AC 633 ms
67,044 KB
testcase_36 AC 680 ms
66,760 KB
testcase_37 AC 135 ms
58,100 KB
testcase_38 AC 600 ms
67,192 KB
testcase_39 AC 656 ms
66,604 KB
testcase_40 AC 653 ms
66,408 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
import java.util.Stack;

class Main {
	public static void main(String[] $) {
		new Main().run();
	}
	
	void run() {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int[] A=new int[(int)2e5+1];
		int[] s=new int[(int)2e5+1];
		long ans=0;
		for (int i=0;i<N;++i) {
			int a=sc.nextInt();
			s[a]++;
			ans+=1L*a*N;
			A[a]++;
		}
		for (int i=s.length-2;i>=0;--i) {
			s[i]+=s[i+1];
		}
		for (int i=0;i<=(int)2e5;++i) {
			if (A[i]==0) continue;
			for (int a=i;a<s.length;a+=i) {
				ans-=1L*s[a]*i*A[i];
			}
		}
		System.out.println(ans);
		
	}
	
	void tr(Object...objects) {System.out.println(Arrays.deepToString(objects));}
}
0