[백준 30030] 스위트콘 가격 구하기 (C#, C++) - soo:bak
작성일 :
문제 링크
설명
부가가치세 10%가 포함된 가격이 주어질 때, 세전 가격을 구하는 문제입니다.
접근법
세후 가격은 세전 가격의 1.1배이므로, 세후 가격을 11로 나눈 뒤 10을 곱하면 세전 가격을 구할 수 있습니다.
Code
C#
1
2
3
4
5
6
7
8
9
using System;
class Program {
static void Main() {
var b = int.Parse(Console.ReadLine()!);
var a = (b / 11) * 10;
Console.WriteLine(a);
}
}
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int b; cin >> b;
int a = (b / 11) * 10;
cout << a << "\n";
return 0;
}