結果
| 問題 |
No.414 衝動
|
| コンテスト | |
| ユーザー |
moyashi_senpai
|
| 提出日時 | 2016-08-26 22:50:29 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 12 ms / 1,000 ms |
| コード長 | 1,134 bytes |
| コンパイル時間 | 876 ms |
| コンパイル使用メモリ | 78,968 KB |
| 実行使用メモリ | 7,680 KB |
| 最終ジャッジ日時 | 2024-11-15 09:03:44 |
| 合計ジャッジ時間 | 1,630 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:50:32: warning: zero-length gnu_printf format string [-Wformat-zero-length]
50 | printf("");
| ^~
main.cpp:45:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
45 | scanf("%lld", &m);
| ~~~~~^~~~~~~~~~~~
ソースコード
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#define REP(i,n) for(int i = 0; n > i; i++)
#define MOD 1000000007
#define accm(i) ( (i)%2 ? od[((i)-1)/2] : ev[(i)/2])
#define acc(i) ( i%2 ? cpod[(i-1)/2] : cpev[i/2])
using namespace std;
typedef vector<int> Ivec;
typedef pair<int, int> pii;
int arr [1000005];
void Eratosthenes(int N) {//Nまでの素数表
for (int i = 0; i < N; i++) {
arr[i] = 1;
}
for (int i = 2; i < sqrt(N); i++) {
if (arr[i]) {
for (int j = i * 2; j <= N; j += i) {
arr[j] = 0;
}
}
}
int cou = 0;
for (int i = 2; N >= i; i++) {
if (arr[i]) {
arr[cou] = i;
cou++;
}
}
}
int main() {
long long int m;
scanf("%lld", &m);
Eratosthenes(1000004);
for (int i = 0; (long long int)arr[i]*arr[i] <= m; i++) {
if (arr[i] == 0) {
printf("");
}
if (!(m%arr[i])) {
printf("%d %lld\n", arr[i], m/arr[i]);
return 0;
}
}
printf("%d %lld\n", 1, m);
return 0;
}
moyashi_senpai