結果

問題 No.1611 Minimum Multiple with Double Divisors
ユーザー 沙耶花
提出日時 2021-07-21 21:29:12
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 721 bytes
コンパイル時間 3,722 ms
コンパイル使用メモリ 252,088 KB
最終ジャッジ日時 2025-01-23 03:29:01
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 9 WA * 28
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:31:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   31 |                 scanf("%lld",&X);
      |                 ~~~~~^~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000000000000000

int main(){
	
	vector<long long> p;
	
	for(long long i=2;true;i++){
		if(p.size()>30)break;
		bool f = true;
		rep(j,p.size()){
			if(i%p[j]==0){
				f = false;
				break;
			}
		}
		if(f)p.push_back(i);
	}
	
	int _t;
	cin>>_t;
	
	rep(_,_t){
		long long X;
		scanf("%lld",&X);
		
		long long mini = Inf;
		
		rep(i,p.size()){
			long long cur = 1LL;
			while(true){
				cur *= p[i];
				if(X%cur!=0){
					break;
				}
			}
			mini = min(mini,cur);
		}
		
		cout<<X*mini<<endl;
		
	}
	
	return 0;
}
0