結果

問題 No.16 累乗の加算
ユーザー ReERishunReERishun
提出日時 2020-05-14 08:24:40
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 1,020 bytes
コンパイル時間 854 ms
コンパイル使用メモリ 29,088 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-12 22:58:15
合計ジャッジ時間 1,315 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
#include<string.h>

typedef unsigned int u_int;
typedef unsigned long long u_long2;

// 入力関数
void numin(int index, int *numBox) {
	char str;
	for (int i = 0; i<index; i++)
		numBox[i] = 0;
	int cnt = 0;
	while (cnt < index) {
		str = getchar();
		if (str == '\n') {
			if (cnt != 0)
				break;
		}
		else if (str < '0' || str > '9')
			cnt++;
		else
			numBox[cnt] = numBox[cnt] * 10 + (int)str - (int)'0';
	}
}


// 累乗関数
u_long2 rr_exponen(u_int radix, int index) {
	u_long2 ans = 1;
	for (int i = 0; i < index; i++) {
		ans *= radix;
		if (ans >= 1000003)
			ans %= 1000003;
	}
	return ans;
}


int main() {
	u_long2	ans = 0;
	u_int	radix = 0;
	u_int	number = 0;
	u_int	index[100];

	scanf("%u %u", &radix, &number);
	printf("%u %u\n", radix, number);

	numin(number, index);
	for (int i = 0; i < number; i++)
		printf("%d ", index[i]);
	return 0;

	for (u_int i = 0; i < number; i++) 
		ans += rr_exponen(radix, index[i]);

	printf("%llu", ans);
		// 終了コードは0
	return 0;
}
0