Submission #3552239


Source Code Expand

#include <cstdio>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <algorithm>
#define ri register int

using namespace std;

bool check(int x){
	for(ri i = 2;i <= sqrt(x);i ++)
		if(x%i == 0)
			return false;
	return true;
}

int main() {
	int n;
	scanf("%d",&n);
	while(n != 0) {
		for(ri i = n;i >= 1;i --)
			if(n%i == 0)
				if(check(i)) {
					printf("%d\n",i);
					break;
				}
		scanf("%d",&n);
	}
	return 0;
}

Submission Info

Submission Time
Task B - Working for the World
User luogu_bot1
Language C++ (GCC 5.4.1)
Score 0
Code Size 484 Byte
Status TLE
Exec Time 2103 ms
Memory 256 KB

Compile Error

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

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
AC × 9
TLE × 18
Set Name Test Cases
All 00-sample, 10-minimum, 11-maximum, 12-little, 13-large, 14-middle, 15-zero, 50-random00, 50-random01, 50-random02, 50-random03, 50-random04, 50-random05, 50-random06, 50-random07, 50-random08, 50-random09, 50-random10, 50-random11, 50-random12, 50-random13, 50-random14, 50-random15, 50-random16, 50-random17, 50-random18, 50-random19
Case Name Status Exec Time Memory
00-sample AC 97 ms 256 KB
10-minimum AC 1 ms 256 KB
11-maximum AC 292 ms 256 KB
12-little AC 1 ms 256 KB
13-large TLE 2103 ms 256 KB
14-middle AC 1107 ms 256 KB
15-zero AC 1 ms 256 KB
50-random00 TLE 2103 ms 256 KB
50-random01 TLE 2103 ms 256 KB
50-random02 TLE 2103 ms 256 KB
50-random03 TLE 2103 ms 256 KB
50-random04 AC 1896 ms 256 KB
50-random05 TLE 2103 ms 256 KB
50-random06 TLE 2103 ms 256 KB
50-random07 TLE 2094 ms 256 KB
50-random08 TLE 2103 ms 256 KB
50-random09 AC 1937 ms 256 KB
50-random10 TLE 2103 ms 256 KB
50-random11 AC 1949 ms 256 KB
50-random12 TLE 2103 ms 256 KB
50-random13 TLE 2103 ms 256 KB
50-random14 TLE 2103 ms 256 KB
50-random15 TLE 2103 ms 256 KB
50-random16 TLE 2103 ms 256 KB
50-random17 TLE 2103 ms 256 KB
50-random18 TLE 2103 ms 256 KB
50-random19 TLE 2103 ms 256 KB