結果
問題 |
No.432 占い(Easy)
|
ユーザー |
![]() |
提出日時 | 2019-08-27 14:35:31 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 802 bytes |
コンパイル時間 | 491 ms |
コンパイル使用メモリ | 31,232 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-15 18:14:02 |
合計ジャッジ時間 | 1,457 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 22 |
ソースコード
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdbool.h> #include <math.h> int main(void) { int testcase; char str[1000]=""; int ans[1000]={0}; scanf("%d",&testcase); for(int i=0;i<testcase;i++) { scanf("%s",str); while(strlen(str)>1) { int len=strlen(str); for(int j=0,k=0;j<len-1;j++,k++) { int val=(str[j]-'0')+(str[j+1]-'0'); if(val>=10) { val=val/10+val%10; } ans[k]=val; } ans[len-1]=0; for(int j=0;j<len-1;j++) { str[j]='0'+ans[j]; } str[len-1]='\0'; } printf("%c\n",str[0]); } }