Codeforces 479【A】div3 try the water

Topic link: http://codeforces.com/problemset/problem/977/A

 

Question meaning: This question, the title is to let you play according to his rules. Divide by 10 if the end is 0, not -1.

 

Solution: The solution is the meaning of the problem.

 

 

 1 #include<iostream>
 2 using namespace std;
 3 
 4 int main(){
 5     int n,k;
 6     cin>>n>>k;
 7     while(k--){
 8         if(n%10 == 0){
 9             n /= 10;
10         } 
11         else{
12             n-=1;
13         }
14     }
15     cout<<n<<endl;
16     
17     return 0;
18 } 
View Code

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325689232&siteId=291194637