結果
| 問題 |
No.858 わり算
|
| コンテスト | |
| ユーザー |
tsuishi
|
| 提出日時 | 2020-12-24 15:14:17 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 2,018 bytes |
| コンパイル時間 | 131 ms |
| コンパイル使用メモリ | 26,112 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2025-01-05 15:08:43 |
| 合計ジャッジ時間 | 616 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 7 WA * 1 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:32:31: warning: ignoring return value of ‘fgets’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
32 | #define INPUT(str) do{char *p;fgets(str,sizeof(str),stdin);p=strchr(str,'\n');if(p)*p='\0';}while(0)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:61:9: note: in expansion of macro ‘INPUT’
61 | INPUT(str); sscanf( str , "%d %d", &aa, &bb );
| ^~~~~
ソースコード
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// ***********************
// for debug
#define DEBUGz
#define NOP do{}while(0)
#ifdef DEBUG
#define TRACE(...) do{printf(__VA_ARGS__);fflush(stdout);}while(0)
#define TRACECR do{printf("\n");fflush(stdout);}while(0)
#else
#define TRACE(...) NOP
#define TRACECR NOP
#endif
#define PRINCR printf("\n")
#define NOCR(strig) do{char *p;p=strchr(strig,'\n');if(p)*p='\0';}while(0)
// The out-of-date function
#define asctime(...) asctime_s(...)
#define atof(a) strtod(a,'\0')
#define atoi(a) ((int)strtol(a,'\0'))
#define atol(a) strtol(a,'\0')
#define ctime(...) ctime_s(...)
//#define fopen(...) fopen_s(...)
//#define freopen(...) freopen_s(...)
//#define rewind(a) fseek(a,0L,SEEK_SET)
//#define setbuf(a,b) setvbuf(a,b,_IOFBF,BUFSIZ)
// for stdio
#define INPUT(str) do{char *p;fgets(str,sizeof(str),stdin);p=strchr(str,'\n');if(p)*p='\0';}while(0)
static char *getinput( char* str );
// for readaility
typedef long long lolong;
const int INF = 1e9;
const int MOD = 1e9+7;
const lolong LINF = 1e18;
#define YES(a) printf("%s",((a)?"YES":"NO"))
#define Yes(a) printf("%s",((a)?"Yes":"No"))
#define OK(a) printf("%s",((a)?"OK":"NG"))
#define Ok(a) printf("%s",((a)?"Ok":"Ng"))
#define POSSIBLE(a) printf("%s",((a)?"POSSIBLE":"IMPOSSIBLE"))
#define Possible(a) printf("%s",((a)?"Possible":"Impossible"))
#define SWAP(type,a,b) do{type _c;_c=a;a=b;b=_c;}while(0)
#define REP(a,b) for(int a=0;a<(int)(b);++a)
#define REP1(a,b) for(int a=1;a<=(b);++a)
#define FLOOP(a,b) for(a=0;a<(b);++a)
#define FLOOP1(a,b) for(a=1;a<=(b);++a)
// ***********************
// ***********************
// ***********************
int main(void){
char str[56];
int val;
unsigned int aa,bb,cc,amari;
// init
// ready
INPUT(str); sscanf( str , "%d %d", &aa, &bb );
// start
cc = aa / bb;
printf("%d.",cc);
amari = aa - bb*cc;
aa = amari *10;
REP(i,50) {
cc = aa / bb;
printf("%d",cc);
amari = aa - bb*cc;
aa = amari *10;
}
PRINCR;
return 0;
}
tsuishi