标签:exe i++ lin int gis constrain code select long
Time limit : 2sec / Memory limit : 1000MB
Score: 200 points
Today, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.
As the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.
Find the N-th smallest integer that would make Ringo happy.
给你两个数D和N,求第N个整除10D但不整除10D+1的数.
我们可以先预处理出10D后直接乘上N,但是N=100时乘上的是N+1.
/* Name: Ringo‘s Favorite Numbers Author: FZSZ-LinHua Date: 2018 06 16 Exec time: 1ms Memory usage: 128KB Score: 200 Algorithm: Brute-force */ # include "iostream" # include "cstdio" using namespace std; int d, n; long long mul=1ll; int main(){ scanf("%d%d",&d,&n); register int i; for(i=1;i<=d;i++){ //预处理出10^d mul*=100; } printf("%lld",(n+(n==100))*mul); //等价于n=100时乘101否则乘上n return 0; }
[ABC 100] B-Ringo's Favorite Numbers
标签:exe i++ lin int gis constrain code select long
原文地址:https://www.cnblogs.com/FJ-LinHua/p/9192816.html