結果
| 問題 | 
                            No.432 占い(Easy)
                             | 
                    
| コンテスト | |
| ユーザー | 
                             takatowin
                         | 
                    
| 提出日時 | 2017-01-07 17:05:11 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 1 ms / 2,000 ms | 
| コード長 | 480 bytes | 
| コンパイル時間 | 362 ms | 
| コンパイル使用メモリ | 30,976 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-12-17 16:20:57 | 
| 合計ジャッジ時間 | 1,260 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 22 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:24:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   24 |   scanf("%d",&t);
      |   ~~~~~^~~~~~~~~
main.cpp:27:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   27 |     scanf("%s",s);
      |     ~~~~~^~~~~~~~
            
            ソースコード
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
void make(char* s){
  int i,j,x=strlen(s);
  char temp;
  if(x==1){
    printf("%s\n",s);
    return;
  }
  for(i=x;i>0;i--){
    for(j=0;j<i-1;j++){
      temp=s[j]+s[j+1]-2*48;
      if(temp>=10)
        temp-=9;
      s[j]=temp+48;
    }
  }
  printf("%d\n",(int)s[0]-48);
}
int main(void){
  int i,t;
  scanf("%d",&t);
  char s[1001];
  for(i=0;i<t;i++){
    scanf("%s",s);
    make(s);
  }
return 0;
}
            
            
            
        
            
takatowin