Rollovers Summary - Luo Xiaoyu buy stationery Valley P1421

Topic P1421 Xiaoyu buy stationery

 Luo Gu test question bank, never thought of WA

Thinking

Simple mathematical calculations, reads A, B, n is the total amount of money, the use of characteristic int, k = n / 1.9 Direct (corresponding to ignore the remainder) operator

Note: A, B is defined as a double, to avoid B / 10 == 0; (otherwise: b = 2,2 / 10 = 0, WA)

Code

#include<iostream>
using namespace std;
double a,b;
double n;
int k;
int main()
{
cin>>a>>b;
n=a+b/10;
k=n/1.9;
cout<<k;
return 0;
}

Guess you like

Origin www.cnblogs.com/lihaolin/p/11267619.html