結果
| 問題 | No.747 循環小数N桁目 Hard |
| コンテスト | |
| ユーザー |
testestest
|
| 提出日時 | 2018-10-19 21:31:54 |
| 言語 | C (gcc 15.2.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 289 bytes |
| 記録 | |
| コンパイル時間 | 327 ms |
| コンパイル使用メモリ | 27,320 KB |
| 最終ジャッジ日時 | 2026-01-03 17:38:48 |
| 合計ジャッジ時間 | 1,391 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.c: In function 'main':
main.c:5:9: error: implicit declaration of function 'gets' [-Wimplicit-function-declaration]
5 | gets(s);
| ^~~~
main.c:16:9: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
16 | printf("%d",a[temp]);
| ^~~~~~
main.c:2:1: note: include '<stdio.h>' or provide a declaration of 'printf'
1 | #include <string.h>
+++ |+#include <stdio.h>
2 | int a[]={4,2,8,5,7,1};
main.c:16:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
16 | printf("%d",a[temp]);
| ^~~~~~
main.c:16:9: note: include '<stdio.h>' or provide a declaration of 'printf'
ソースコード
#include <string.h>
int a[]={4,2,8,5,7,1};
char s[100010];
int main(){
gets(s);
int n=strlen(s);
int temp=0;
for(int i=0;i<n;i++)temp+=s[i]-48;
temp%=3;
int temp2=s[n-1]%2;
gets(s);
int k=s[strlen(s)-1]%2;
if(k==0)temp=!!temp;
if(temp%2!=temp2)temp+=3;
printf("%d",a[temp]);
}
testestest