提出 #772728
ソースコード 拡げる
using System.Collections;
using System.Linq;
using System.Collections.Generic;
using System;
using System.Windows;
namespace ABC{
class ABC{
class Vector2
{
public int x;
public int y;
public int GetX(){
return x;
}
public int GetY(){
return y;
}
public Vector2(int a,int b){
x = a;
y = b;
}
}
static int[] ScanInt(){
string[] a = Console.ReadLine().Split(' ');
int[] b = new int[a.Length];
int j = 0;
foreach(string z in a){
b[j] = int.Parse(z);
j++;
}
return b;
}
static char[] ScanChar(){
string a = Console.ReadLine();
char[] b = a.ToCharArray();
return b;
}
static void Main(string[] args){
int x = int.Parse (Console.ReadLine());
int g = (int)Math.Sqrt(x);
int st = x - g*g;
int ans = st;
int v;
int h = st+1;
for (int i=0; i<st; i++) {
v = x-i;
if(ans <= i)
break;
for(int j=(int)Math.Sqrt(v);j<v;j++){
if(v%j==0){
h = Math.Abs((v/j)-j);
break;
}
}
if(ans>h+i)
ans = h+i;
}
Console.WriteLine (ans);
}
}
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | B - □□□□□ |
| ユーザ | udonudon |
| 言語 | C# (Mono 4.6.2.0) |
| 得点 | 100 |
| コード長 | 1227 Byte |
| 結果 | AC |
| 実行時間 | 35 ms |
| メモリ | 2648 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 100 / 100 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | sample_01.txt, sample_02.txt, sample_03.txt |
| All | sample_01.txt, sample_02.txt, sample_03.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| sample_01.txt | AC | 30 ms | 2648 KiB |
| sample_02.txt | AC | 30 ms | 2648 KiB |
| sample_03.txt | AC | 35 ms | 2648 KiB |
| subtask1_01.txt | AC | 31 ms | 2648 KiB |
| subtask1_02.txt | AC | 33 ms | 2648 KiB |
| subtask1_03.txt | AC | 31 ms | 2648 KiB |
| subtask1_04.txt | AC | 31 ms | 2648 KiB |
| subtask1_05.txt | AC | 31 ms | 2648 KiB |
| subtask1_06.txt | AC | 32 ms | 2648 KiB |
| subtask1_07.txt | AC | 31 ms | 2648 KiB |
| subtask1_08.txt | AC | 33 ms | 2648 KiB |
| subtask1_09.txt | AC | 32 ms | 2648 KiB |
| subtask1_10.txt | AC | 33 ms | 2648 KiB |
| subtask1_11.txt | AC | 34 ms | 2648 KiB |
| subtask1_12.txt | AC | 32 ms | 2648 KiB |