結果

問題 No.858 わり算
ユーザー kuhaku
提出日時 2019-08-29 20:43:45
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 238 bytes
コンパイル時間 936 ms
コンパイル使用メモリ 24,704 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2025-01-07 14:51:39
合計ジャッジ時間 691 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 9
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:7:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |   scanf("%ld%ld", &a, &b);
      |   ^~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(void){
  int i;

  long a, b;
  scanf("%ld%ld", &a, &b);

  printf("%ld.", a/b);

  long rest=a%b;
  for(i=0;i<50;i++){
    rest*=10;
    printf("%ld", rest/b);
    rest%=b;
  }
  printf("\n");

  return 0;
}
0