結果

問題 No.300 平方数
ユーザー kongarishisyamokongarishisyamo
提出日時 2016-05-02 04:38:18
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 624 bytes
コンパイル時間 859 ms
コンパイル使用メモリ 61,232 KB
実行使用メモリ 15,560 KB
最終ジャッジ日時 2024-04-15 09:04:20
合計ジャッジ時間 8,099 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
15,504 KB
testcase_01 AC 137 ms
15,504 KB
testcase_02 AC 112 ms
15,560 KB
testcase_03 AC 121 ms
15,428 KB
testcase_04 AC 112 ms
15,432 KB
testcase_05 AC 123 ms
15,300 KB
testcase_06 AC 107 ms
15,432 KB
testcase_07 AC 132 ms
15,300 KB
testcase_08 AC 121 ms
15,424 KB
testcase_09 AC 131 ms
15,428 KB
testcase_10 AC 121 ms
15,552 KB
testcase_11 AC 138 ms
15,552 KB
testcase_12 AC 130 ms
15,428 KB
testcase_13 AC 124 ms
15,428 KB
testcase_14 AC 124 ms
15,504 KB
testcase_15 AC 138 ms
15,300 KB
testcase_16 AC 121 ms
15,500 KB
testcase_17 AC 126 ms
15,428 KB
testcase_18 AC 141 ms
15,424 KB
testcase_19 AC 137 ms
15,432 KB
testcase_20 WA -
testcase_21 AC 115 ms
15,424 KB
testcase_22 AC 116 ms
15,432 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 121 ms
15,556 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 AC 120 ms
15,428 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cmath>
#include<algorithm>

using namespace std;

#define MAX (10000000)
bool hurui[MAX+1];
long long p[300000];
long long pn=0;
long long N;

int main(){

    for(long long i=0;i<MAX+1;i++) hurui[i]=0;

    for(long long i=2;i<=MAX;i++){
        if(hurui[i]==0){
            for(long long j=i;j<=MAX;j+=i){
                hurui[j]=1;
            }
            p[pn]=i;
            pn++;
        }
    }

	cin>>N;

    long long ans=1;
	for(int i=0;i<pn;i++){
		if(N%p[i]==0){
			long long c=0;
			while(N%p[i]==0){
				N/=p[i];
				c++;
			}
			if(c%2==1) ans*=p[i];
		}
	}

	cout<<ans<<endl;
}
0