結果
| 問題 |
No.747 循環小数N桁目 Hard
|
| コンテスト | |
| ユーザー |
👑 testestest
|
| 提出日時 | 2018-10-19 21:31:54 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 289 bytes |
| コンパイル時間 | 361 ms |
| コンパイル使用メモリ | 29,440 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-18 20:04:11 |
| 合計ジャッジ時間 | 2,857 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 120 |
コンパイルメッセージ
main.c: In function 'main':
main.c:5:9: warning: implicit declaration of function 'gets' [-Wimplicit-function-declaration]
5 | gets(s);
| ^~~~
main.c:16:9: warning: 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'
/usr/bin/ld: /tmp/ccqUJYn8.o: in function `main':
main.c:(.text.startup+0x11): 警告: the `gets' function is dangerous and should not be used.
ソースコード
#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