結果

問題 No.432 占い(Easy)
ユーザー mosmos_21
提出日時 2016-10-14 22:41:48
言語 C90
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 354 bytes
コンパイル時間 636 ms
コンパイル使用メモリ 20,608 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-22 07:41:46
合計ジャッジ時間 1,091 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 6 WA * 16
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:6:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |   scanf("%lld",&n);
      |   ^~~~~~~~~~~~~~~~
main.c:9:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |     scanf("%lld", &s);
      |     ^~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(){
  long long int n,i,s,t,u,a;

  scanf("%lld",&n);

  for(i = 0; i < n; i++){
    scanf("%lld", &s);

    while(s>9){
      t=s; s=0; u = 1;
      while(t > 9){
        a = t%10 + (t/10) % 10;
        s += a>9 ? (a/10+a%10)*u : a*u;
        u *= 10;
        t /= 10;
      }
    }
    printf("%lld\n",s);
  }
  return 0;
}
0