結果
問題 | No.167 N^M mod 10 |
ユーザー |
![]() |
提出日時 | 2017-02-02 15:59:59 |
言語 | C90 (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 442 bytes |
コンパイル時間 | 200 ms |
コンパイル使用メモリ | 22,528 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-24 03:52:48 |
合計ジャッジ時間 | 1,172 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 23 WA * 4 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:8:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 8 | scanf("%s", n); | ^~~~~~~~~~~~~~ main.c:9:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | scanf("%s", m); | ^~~~~~~~~~~~~~
ソースコード
#include <stdio.h> #include <math.h> int main(void) { int i, j; char n[10001], m[10001]; int n2, m2; scanf("%s", n); scanf("%s", m); m2 = n[0] - '0'; i = 1; while(m[i] != '\0'){ m2 = m2 * 10 + m[i] - '0'; m2 %= 4; i++; } //printf("%d\n", m2); j = 0; while(n[j] != '\0'){ j++; } n2 = n[j - 1] - '0'; //printf("%d^%d = %d\n", n2, m2, (int)pow(n2, m2) % 10); printf("%d\n", (int)pow(n2, m2 + 4) % 10); return 0; }