結果
問題 |
No.1081 和の和
|
ユーザー |
![]() |
提出日時 | 2025-09-08 11:36:31 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 157 ms / 2,000 ms |
コード長 | 627 bytes |
コンパイル時間 | 2,158 ms |
コンパイル使用メモリ | 77,744 KB |
実行使用メモリ | 46,648 KB |
最終ジャッジ日時 | 2025-09-08 11:36:36 |
合計ジャッジ時間 | 4,296 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 8 |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); List<Long> list = new ArrayList<Long>(); for(int i = 0 ; i < n ; i++){ list.add(scan.nextLong()); } long remainder = 1000000007; while(list.size() > 1){ List<Long> listCopy = new ArrayList<Long>(); for(int i = 0 ; i < list.size()-1 ; i++){ listCopy.add((list.get(i) + list.get(i+1)) % remainder); } list = listCopy; } System.out.println(list.get(0)); } }