結果
| 問題 |
No.56 消費税
|
| コンテスト | |
| ユーザー |
Maeda
|
| 提出日時 | 2025-03-03 13:44:33 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| コード長 | 590 bytes |
| コンパイル時間 | 155 ms |
| コンパイル使用メモリ | 27,904 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2025-03-03 13:44:35 |
| 合計ジャッジ時間 | 1,561 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 23 |
ソースコード
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#define MAX_LEN (256)
void uint2str(char str[], size_t len, double num) {
snprintf(str, len, "%f", num);
}
void main(void){
double a = 0 , b = 0;
int inputA = scanf("%le\n",&a);
if(inputA == 2){
printf("Aの入力エラー\n");
}
int inputB = scanf("%le\n",&b);
if(inputB == 2){
printf("Bの入力エラー\n");
}
double tax = b/100 + 1;
double sum = a * tax;
char sumStr[MAX_LEN];
uint2str(sumStr,MAX_LEN,a * tax);
int i = 0;
while(sumStr[i] != '.'){
printf("%c",sumStr[i]);
i++;
}
}
Maeda