結果
問題 |
No.1233 割り切れない気持ち
|
ユーザー |
|
提出日時 | 2020-09-21 05:53:27 |
言語 | Java (openjdk 23) |
結果 |
TLE
|
実行時間 | - |
コード長 | 677 bytes |
コンパイル時間 | 2,542 ms |
コンパイル使用メモリ | 77,732 KB |
実行使用メモリ | 78,828 KB |
最終ジャッジ日時 | 2024-06-24 11:21:26 |
合計ジャッジ時間 | 15,990 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 15 TLE * 1 -- * 23 |
ソースコード
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[N]; int[] s=new int[(int)2e5+1]; long ans=0; for (int i=0;i<N;++i) { A[i]=sc.nextInt(); s[A[i]]++; ans+=1L*A[i]*N; } for (int i=s.length-2;i>=0;--i) { s[i]+=s[i+1]; } for (int i=0;i<N;++i) { for (int a=A[i];a<s.length;a+=A[i]) { ans-=1L*s[a]*A[i]; } } System.out.println(ans); } void tr(Object...objects) {System.out.println(Arrays.deepToString(objects));} }