제출 #1252939

#제출 시각아이디문제언어결과실행 시간메모리
1252939mardaTrol (COCI19_trol)C++20
20 / 50
0 ms2648 KiB
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <tuple>

#define endl "\n"
#define int long long int
#define ld long double
#define mp make_pair
#define pb push_back
#define Bound 1001

using namespace std;


int32_t main()
{

	int t;
	cin >> t;

	while (t--) {

		int a, b;
		cin >> a >> b;


		int firstNum = (a - 1) % 9 + 1;
		int secondNum = (b - 1) % 9 + 1;
		int difference = b - a + 1;

		int totalTo9_1st = (10 - firstNum) * (9 + firstNum) / 2;
		int totalTo9_2nd = (secondNum) * (1 + secondNum) / 2;

		int dfrc = ceil((float)b / 9) - ceil((float)a / 9) - 1;

		cout << totalTo9_1st + totalTo9_2nd + dfrc * 45 << endl;

	}

	return 0;

}
#Verdict Execution timeMemoryGrader output
Fetching results...