Submission #8156413


Source Code Expand

Copy
#include<bits/stdc++.h>
using namespace std;
#define N 1000005
int n,m,len;
int a[N];
bool f[N];
char s[N];
int main()
{
	int T=1;
	//scanf("%d",&T);
	while(T--)
	{
		long long n1;
		scanf("%lld",&n1);
		long long ans=n1-1;
		for(int i=2;1ll*i*i<=n1;i++)
			if(n1%i==0)
				ans=min(ans,i+n1/i-2);
		printf("%lld",ans);
	}
}

Submission Info

Submission Time
Task C - Walk on Multiplication Table
User C20193620
Language C++14 (GCC 5.4.1)
Score 300
Code Size 344 Byte
Status AC
Exec Time 11 ms
Memory 256 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:15:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld",&n1);
                    ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 41
Set Name Test Cases
Sample sample_01, sample_02, sample_03
All hand_01, hand_02, hand_03, hand_04, hand_05, hand_06, hand_07, hand_08, large_01, large_02, large_03, large_04, large_05, large_06, large_07, large_08, prime_01, prime_02, prime_03, random_01, random_02, random_03, random_04, random_05, random_06, random_07, random_08, sample_01, sample_02, sample_03, small_01, small_02, small_03, small_04, small_05, small_06, small_07, small_08, square_01, square_02, square_03
Case Name Status Exec Time Memory
hand_01 AC 11 ms 256 KB
hand_02 AC 1 ms 256 KB
hand_03 AC 11 ms 256 KB
hand_04 AC 9 ms 256 KB
hand_05 AC 6 ms 256 KB
hand_06 AC 11 ms 256 KB
hand_07 AC 11 ms 256 KB
hand_08 AC 11 ms 256 KB
large_01 AC 11 ms 256 KB
large_02 AC 10 ms 256 KB
large_03 AC 10 ms 256 KB
large_04 AC 9 ms 256 KB
large_05 AC 10 ms 256 KB
large_06 AC 9 ms 256 KB
large_07 AC 9 ms 256 KB
large_08 AC 11 ms 256 KB
prime_01 AC 9 ms 256 KB
prime_02 AC 9 ms 256 KB
prime_03 AC 9 ms 256 KB
random_01 AC 10 ms 256 KB
random_02 AC 8 ms 256 KB
random_03 AC 6 ms 256 KB
random_04 AC 6 ms 256 KB
random_05 AC 3 ms 256 KB
random_06 AC 7 ms 256 KB
random_07 AC 7 ms 256 KB
random_08 AC 11 ms 256 KB
sample_01 AC 1 ms 256 KB
sample_02 AC 1 ms 256 KB
sample_03 AC 2 ms 256 KB
small_01 AC 1 ms 256 KB
small_02 AC 1 ms 256 KB
small_03 AC 1 ms 256 KB
small_04 AC 1 ms 256 KB
small_05 AC 1 ms 256 KB
small_06 AC 1 ms 256 KB
small_07 AC 1 ms 256 KB
small_08 AC 1 ms 256 KB
square_01 AC 8 ms 256 KB
square_02 AC 5 ms 256 KB
square_03 AC 11 ms 256 KB