結果
| 問題 |
No.858 わり算
|
| コンテスト | |
| ユーザー |
michonz4
|
| 提出日時 | 2019-12-29 18:40:36 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
RE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 418 bytes |
| コンパイル時間 | 1,429 ms |
| コンパイル使用メモリ | 25,472 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2025-01-05 14:44:15 |
| 合計ジャッジ時間 | 4,851 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 2 |
| other | RE * 8 |
コンパイルメッセージ
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("%lld %lld", &a, &b);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
#include <string.h>
int main() {
long long a, b, t, cnt=0, i;
char num[53];
scanf("%lld %lld", &a, &b);
t=a/b;
snprintf(num, 53, "%lld.", t);
do {
cnt++;
t/=10;
} while (t);
a%=b;
for (i=cnt+1; i<cnt+51; i+=10) {
t=(a*10000000000)/b;
snprintf(num+strlen(num), 53, "%.10lld", t);
a=(a*10000000000)%b;
}
num[i]='\0';
printf("%s\n", num);
return 0;
}
michonz4