Educational Codeforces Round 23 C. Really Big Numbers
来源:互联网 发布:网络冗余技术应用 编辑:程序博客网 时间:2024/06/07 01:24
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different special properties, he wants to know how rare (or not rare) they are — in fact, he needs to calculate the quantity of really big numbers that are not greater than n.
Ivan tried to do the calculations himself, but soon realized that it's too difficult for him. So he asked you to help him in calculations.
The first (and the only) line contains two integers n and s (1 ≤ n, s ≤ 1018).
Print one integer — the quantity of really big numbers that are not greater than n.
12 1
3
25 20
0
10 9
1
In the first example numbers 10, 11 and 12 are really big.
In the second example there are no really big numbers that are not greater than 25 (in fact, the first really big number is 30: 30 - 3 ≥ 20).
In the third example 10 is the only really big number (10 - 1 ≥ 9).
然后问过别人后,就是说给定一个s和一个n问,从1开始到s有多少个数减去它的位数和大于等于n。。
然后暴力。。。
#include<bits/stdc++.h>#include<iostream>#define ll long longusing namespace std;int main(){ ll n,s; cin>>n>>s; ll ans=0; for(ll i=s+1;i<=s+200&&i<=n;i++) { ll t=i; ll r=0; while(t!=0) { r+=t%10; t=t/10; } if(r+s<=i)ans++; } s=s+200; long long int m=0; ans=ans+max(n-s,m); cout<<ans<<endl;}
- Educational Codeforces Round 23 C. Really Big Numbers
- Educational Codeforces Round 23#C. Really Big Numbers
- Educational Codeforces Round 23 C. Really Big Numbers(二分 数学)
- codeforces 817C Really Big Numbers 二分
- 【Codeforces 817C. Really Big Numbers】+ 二分
- 【Codeforces 817 C. Really Big Numbers】+ 构造
- codeforces 817C Really Big Numbers 二分
- codeforces 817C Really Big Numbers
- Codeforces 817 C. Really Big Numbers 二分
- C. Really Big Numbers
- C. Really Big Numbers
- Codeforces 817C Really Big Numbers【思维+二分】
- CodeFroces 817C Really Big Numbers(二分)
- codeforces817c Really Big Numbers
- 补题补题补题~~~~really big numbers
- Educational Codeforces Round 2 A. Extract Numbers
- Educational Codeforces Round 21 C
- Educational Codeforces Round 5 C
- 原生JS判断两个元素是否为兄弟节点
- 【Unity】AssetBundle和AssetBundle Manager的使用和介绍(流程和依赖关系)
- # 美团点评CodeM编程大赛-题四
- 使用IntelliJ IDEA 配置Maven项目(入门)转:http://blog.csdn.net/qq_32588349/article/details/51461182
- udp server.c
- Educational Codeforces Round 23 C. Really Big Numbers
- WINDOWS相关软件下载链接
- android dm-verity 功能
- Spark多文件输出(MultipleTextOutputFormat)
- React常见问题记录
- NS2网络仿真
- php获取数组长度的方法+实例
- 浅析Apache Spark Caching和Checkpointing
- mui 总页面