結果
問題 |
No.694 square1001 and Permutation 3
|
ユーザー |
![]() |
提出日時 | 2018-06-08 23:48:05 |
言語 | Java (openjdk 23) |
結果 |
TLE
|
実行時間 | - |
コード長 | 826 bytes |
コンパイル時間 | 2,189 ms |
コンパイル使用メモリ | 73,672 KB |
実行使用メモリ | 78,268 KB |
最終ジャッジ日時 | 2024-06-30 11:16:35 |
合計ジャッジ時間 | 10,512 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 1 |
other | AC * 7 TLE * 1 -- * 5 |
ソースコード
import java.util.*; class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] a = new int[n]; for(int i=0; i<n; i++) a[i] = in.nextInt(); for(int i=0; i<n; i++) { int cnt = 0; int[] t = new int[n]; for(int j=0; j<n; j++) { int temp = (i+j) % n; t[j] = a[temp]; } for(int j=0; j<n; j++) { for(int k=0; k<n-1; k++) { if(t[k] > t[k+1]) { int c = t[k]; t[k] = t[k+1]; t[k+1] = c; cnt++; } } } System.out.println(cnt); } } }