Codeforces 479【A】div3试个水

题目链接:http://codeforces.com/problemset/problem/977/A

题意:这个题,题目就是让你根据他的规律玩嘛。末尾是0就除10,不是就-1。

题解:题解即题意。

 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

猜你喜欢

转载自www.cnblogs.com/Asumi/p/9005474.html