Submission #773481


Source Code Expand

Copy
#include <stdio.h>
#include <math.h>
#define min_v(a,b) ((a)<(b))?(a):(b)
// 
int main() {
	int n, xatt, modfirst;
	int y, modsecond, k;
	int minv;
	scanf("%d", &n);
	minv = n;
	for (k = 0; k < n; k++) {
		xatt = (-k+sqrtl(k*k+4*n))/2;
		modfirst = n - xatt*xatt - xatt*k;
		if (k+modfirst < minv)minv = k + modfirst;
		if (k > sqrtl(n))break;
	}
	printf("%d", minv);
	getchar(); getchar();
	return 0;
}

Submission Info

Submission Time
Task B - □□□□□
User sqrt36
Language C (GCC 5.4.1)
Score 100
Code Size 422 Byte
Status
Exec Time 3 ms
Memory 128 KB

Compile Error

./Main.c: In function ‘main’:
./Main.c:9:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
× 3
× 15
Set Name Test Cases
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
Case Name Status Exec Time Memory
sample_01.txt 2 ms 128 KB
sample_02.txt 2 ms 128 KB
sample_03.txt 2 ms 128 KB
subtask1_01.txt 2 ms 128 KB
subtask1_02.txt 2 ms 128 KB
subtask1_03.txt 2 ms 128 KB
subtask1_04.txt 2 ms 128 KB
subtask1_05.txt 2 ms 128 KB
subtask1_06.txt 2 ms 128 KB
subtask1_07.txt 2 ms 128 KB
subtask1_08.txt 3 ms 128 KB
subtask1_09.txt 3 ms 128 KB
subtask1_10.txt 2 ms 128 KB
subtask1_11.txt 2 ms 128 KB
subtask1_12.txt 3 ms 128 KB