还在做的作业

发布时间:2023-11-08 14:07:09
贴主:银河美术馆
热度:1

银河美术馆 2023-11-08

#include<iostream>

#include<cmath>

using namespace std;

int xc(long long int cy) {

 int hy=-1;

 for (;cy>=1;) {

  cy = (cy + 1) / 10;

  hy++;

 }

 return hy;

}

int main() {

 int n;

 cin >> n;

 while (n--)

 {

  long long int m, x, y,cq=0;

  int a, b;

  cin >> x >> y >> m;

  a = xc(x);

  b = xc(y);

  for (int i = a+1; i <b; i++) {

   cq += pow(10, i);

  }

  if ((m + 1) * pow(10, a) - x > pow(10, a))

   cq += pow(10, a);

  else if ((m + 1) * pow(10, a) - x > 0)

   cq += (m + 1) * pow(10, a) - 1 - x;

  cout << cq << endl;

 }

 return 0;

}

(0)

Copyright 2016 - 2024 XUJC ACM Team
闽ICP备2020022076号-1