Submission #3315841


Source Code Expand

#include <bits/stdc++.h>
using namespace std;

long long n;
long long ans;

bool zhi(long long x)
{
    for(long long i=2;i<x;i++)
    {
        if(x%i==0)return false;
    }
    return true;
}

int main()
{
    while(1)
    {
        scanf("%lld",&n);
        if(n==0)break;
        long long last=0;
        for(long long i=1;i*i<=n;i++)
        {
            if(n%i!=0)continue;
            if(zhi(n/i))
                last=max(n/i,last);
            if(zhi(i))
                last=max(i,last);
        }
        printf("%lld\n",last);
    }


    return 0;
}

Submission Info

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

Compile Error

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

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
AC × 22
TLE × 5
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 2 ms 256 KB
10-minimum AC 1 ms 256 KB
11-maximum AC 1 ms 256 KB
12-little AC 2 ms 256 KB
13-large TLE 2103 ms 256 KB
14-middle AC 4 ms 256 KB
15-zero AC 1 ms 256 KB
50-random00 AC 1097 ms 256 KB
50-random01 AC 667 ms 256 KB
50-random02 TLE 2103 ms 256 KB
50-random03 AC 471 ms 256 KB
50-random04 AC 592 ms 256 KB
50-random05 TLE 2103 ms 256 KB
50-random06 AC 1955 ms 256 KB
50-random07 AC 280 ms 256 KB
50-random08 AC 307 ms 256 KB
50-random09 TLE 2006 ms 256 KB
50-random10 AC 159 ms 256 KB
50-random11 AC 1408 ms 256 KB
50-random12 AC 370 ms 256 KB
50-random13 AC 1073 ms 256 KB
50-random14 AC 864 ms 256 KB
50-random15 AC 529 ms 256 KB
50-random16 AC 820 ms 256 KB
50-random17 AC 877 ms 256 KB
50-random18 TLE 2103 ms 256 KB
50-random19 AC 203 ms 256 KB