Maximum-Cup 2013

Submission #3560115

Source codeソースコード

#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

void findPrime(int N, vector<bool>& isPrime)
{
    isPrime.assign(N+1, true);
    isPrime[0] = isPrime[1] = false;
    for(int i=2; i*i<=N; i++){
        if(isPrime[i]){
            for(int j=i; i*j<=N; j++){
                isPrime[i*j] = false;
            }
        }
    }
}

int main()
{
    vector<bool> isPrime;
    findPrime(100000000, isPrime);

    for(;;){
        int n;
        cin >> n;
        if(n == 0)
            return 0;

        int ret = 0;
        for(int i=1; i*i<=n; ++i){
            if(n % i == 0){
                if(isPrime[i])
                    ret = max(ret, i);
                if(isPrime[n/i])
                    ret = max(ret, n/i);
            }
        }
        cout << ret << endl;
    }
}

Submission

Task問題 B - Working for the World
User nameユーザ名 luogu_bot1
Created time投稿日時
Language言語 C++ (GCC 5.4.1)
Status状態 AC
Score得点 100
Source lengthソースコード長 1156 Byte
File nameファイル名
Exec time実行時間 422 ms
Memory usageメモリ使用量 12416 KB

Test case

Set

Set name Score得点 / Max score Cases
All 100 / 100 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

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
00-sample AC 419 ms 12416 KB
10-minimum AC 416 ms 12416 KB
11-maximum AC 422 ms 12416 KB
12-little AC 418 ms 12416 KB
13-large AC 416 ms 12416 KB
14-middle AC 418 ms 12416 KB
15-zero AC 417 ms 12416 KB
50-random00 AC 415 ms 12416 KB
50-random01 AC 412 ms 12416 KB
50-random02 AC 412 ms 12416 KB
50-random03 AC 413 ms 12416 KB
50-random04 AC 415 ms 12416 KB
50-random05 AC 416 ms 12416 KB
50-random06 AC 417 ms 12416 KB
50-random07 AC 417 ms 12416 KB
50-random08 AC 418 ms 12416 KB
50-random09 AC 413 ms 12416 KB
50-random10 AC 418 ms 12416 KB
50-random11 AC 416 ms 12416 KB
50-random12 AC 417 ms 12416 KB
50-random13 AC 413 ms 12416 KB
50-random14 AC 417 ms 12416 KB
50-random15 AC 414 ms 12416 KB
50-random16 AC 414 ms 12416 KB
50-random17 AC 415 ms 12416 KB
50-random18 AC 420 ms 12416 KB
50-random19 AC 414 ms 12416 KB