작성일 :

문제 링크

21633번 - Bank Transfer

설명

송금액에 따른 수수료를 구하는 문제입니다.


접근법

수수료는 기본 25에 송금액의 1%를 더한 값입니다.

단, 최소 100, 최대 2000으로 제한됩니다.

계산 결과를 범위에 맞게 조정한 뒤 소수점 둘째 자리까지 출력합니다.



Code

C#

1
2
3
4
5
6
7
8
9
10
11
using System;

class Program {
  static void Main() {
    var k = int.Parse(Console.ReadLine()!);
    var fee = 25.0 + k * 0.01;
    if (fee < 100.0) fee = 100.0;
    if (fee > 2000.0) fee = 2000.0;
    Console.WriteLine($"{fee:F2}");
  }
}

C++

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <bits/stdc++.h>
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int k; cin >> k;
  double fee = 25.0 + k * 0.01;
  if (fee < 100.0) fee = 100.0;
  if (fee > 2000.0) fee = 2000.0;
  cout.setf(ios::fixed);
  cout.precision(2);
  cout << fee << "\n";

  return 0;
}