結果

問題 No.414 衝動
ユーザー moyashi_senpaimoyashi_senpai
提出日時 2016-08-26 22:26:37
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,077 bytes
コンパイル時間 745 ms
コンパイル使用メモリ 80,620 KB
実行使用メモリ 7,664 KB
最終ジャッジ日時 2024-04-25 23:03:25
合計ジャッジ時間 2,236 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
7,636 KB
testcase_01 AC 10 ms
7,664 KB
testcase_02 AC 9 ms
7,532 KB
testcase_03 AC 9 ms
7,472 KB
testcase_04 WA -
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 10 ms
7,528 KB
testcase_08 RE -
testcase_09 AC 11 ms
7,440 KB
testcase_10 AC 9 ms
7,572 KB
testcase_11 AC 9 ms
7,444 KB
testcase_12 AC 9 ms
7,444 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:50:37: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long long int’ [-Wformat=]
   50 |                         printf("%d %d\n", arr[i], m/arr[i]);
      |                                    ~^             ~~~~~~~~
      |                                     |              |
      |                                     int            long long int
      |                                    %lld
main.cpp:46:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   46 |         scanf("%lld", &m);
      |         ~~~~~^~~~~~~~~~~~

ソースコード

diff #

#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 [1000002];
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() {
	Eratosthenes(1000001);
	long long int m;
	scanf("%lld", &m);

	for (int i = 0; arr[i]*arr[i] <= m; i++) {
		if (!(m%arr[i])) {
			printf("%d %d\n", arr[i], m/arr[i]);
			return 0;
		}
	}
	printf("%d %lld\n", 1, m);
	return 0;
}
0