codeforces B. The number on the board
来源:互联网 发布:淘宝网开放平台 编辑:程序博客网 时间:2024/06/06 19:32
点这里
一开始题意理解错了。。。
就是要求使一个数k的每一位数的总和小于n
#include <iostream>#include <stdio.h>#include <string.h>#include <algorithm>using namespace std;char x[100005];int t[100005];bool cmp(int a,int b){ return a>b;}int main(){ int n; while(~scanf("%d",&n)) { getchar(); gets(x); int len=strlen(x); int ans=0,c=0; for(int i=0; i<len; i++) { t[i]=x[i]-'0'; ans+=t[i]; } if(ans>=n) cout<<0<<endl; else { sort(t,t+len); while(ans<n) { ans+=(9-t[c]); c++; } cout<<c<<endl; } } return 0;}
阅读全文
0 0
- codeforces B. The number on the board
- Codeforces 835B-The number on the board
- Codeforces #835B: The Number on the Board 题解
- Codeforces 835 B The number on the board
- (贪心)Codeforces Round #427 B. The number on the board
- Codeforces 835 B The number on the board
- CodeForces 835B The number on the board
- codeforces 835b The number on the board
- CodeForces 835 B.The number on the board(贪心)
- codeforces 835B The number on the board
- Codeforces 835B The number on the board (贪心)
- codeforces 835b 之 The number on the board
- codeforces 835B The number on the board
- Codeforces-The number on the board
- B. The number on the board
- codeforces 835B The number on the board (优先队列,贪心)
- Codeforces Round #427 (Div. 2) B. The number on the board
- Codeforces Round #427 (Div. 2)-B. The number on the board
- 弹出登录框(可直接修改样式使用)
- 利用percona-toolkit中pt-online-schema-change功能对表进行online ddl
- activeMQ深入了解—队列模式手动控制消费
- 操作系统真相还原——MBR
- ajax嵌套
- codeforces B. The number on the board
- Sandcastle Help File Builder[Missing <summary> documentation for ""]
- eclipse远程调试Tomcat方法
- MySQL Binlog的介绍以及主从配置注意
- 对Kth number的一点小研究——主席树
- idea 控制台中文乱码
- VMware Workstation 错误(虚拟机似乎正在使用无法获得使用权)
- android开源项目
- 课时14 Linux用户基础