結果

問題 No.300 平方数
ユーザー kongarishisyamokongarishisyamo
提出日時 2016-05-02 04:48:19
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 626 bytes
コンパイル時間 494 ms
コンパイル使用メモリ 60,644 KB
実行使用メモリ 33,024 KB
最終ジャッジ日時 2024-04-15 09:06:56
合計ジャッジ時間 17,605 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 340 ms
32,768 KB
testcase_01 AC 336 ms
32,768 KB
testcase_02 AC 325 ms
32,640 KB
testcase_03 AC 344 ms
32,896 KB
testcase_04 AC 329 ms
32,896 KB
testcase_05 AC 325 ms
32,768 KB
testcase_06 AC 350 ms
32,896 KB
testcase_07 AC 334 ms
32,768 KB
testcase_08 AC 355 ms
32,768 KB
testcase_09 AC 335 ms
32,896 KB
testcase_10 AC 330 ms
32,896 KB
testcase_11 AC 336 ms
32,896 KB
testcase_12 AC 353 ms
32,768 KB
testcase_13 AC 343 ms
32,896 KB
testcase_14 AC 333 ms
32,896 KB
testcase_15 AC 326 ms
32,640 KB
testcase_16 AC 332 ms
32,768 KB
testcase_17 AC 345 ms
32,768 KB
testcase_18 AC 313 ms
32,768 KB
testcase_19 AC 324 ms
32,896 KB
testcase_20 WA -
testcase_21 AC 339 ms
32,768 KB
testcase_22 AC 351 ms
32,896 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 328 ms
32,896 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 AC 317 ms
32,768 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

using namespace std;

#define MAX (20000000)
bool hurui[MAX+1];
long long p[30000000];
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