結果
| 問題 | No.2449 square_permutation |
| ユーザー |
|
| 提出日時 | 2023-09-01 17:40:46 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 122 ms / 2,000 ms |
| コード長 | 742 bytes |
| コンパイル時間 | 11,638 ms |
| コンパイル使用メモリ | 104,192 KB |
| 実行使用メモリ | 31,872 KB |
| 最終ジャッジ日時 | 2025-01-03 06:53:20 |
| 合計ジャッジ時間 | 11,602 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System.Collections.Generic;
public class Hello{
public static void Main(){
// Your code here!
int n = int.Parse(System.Console.ReadLine());
int[] ans = new int[n+1];
for(int i=0;i<n+1;i++) ans[i] = 0;
for(int i=1;i<n+1;i++){
if(ans[i] != 0) continue;
List<int> tmp = new List<int>();
for(int j=1;i*j*j<=n;j++){
tmp.Add(i*j*j);
}
for(int j=0;j<tmp.Count;j++){
ans[tmp[j]] = tmp[tmp.Count-1-j];
}
}
int[] anss = new int[n];
for(int i=0;i<n;i++){
anss[i] = ans[i+1];
}
System.Console.WriteLine(string.Join(" ",anss));
}
}