Submission #814586

# Submission time Handle Problem Language Result Execution time Memory
814586 2023-08-08T08:27:15 Z tlnk07 Trol (COCI19_trol) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

long long q, l, r, ans, 

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);	cout.tie(NULL);
	cin >> q;
	while(q--)
	{
		ans = 0;
		cin >> l >> r;
		if((r - l + 1) % 9 == 0)
		{
			ans = (r - l + 1) * 5;
			cout << ans << "\n";
		}
		else
		{
			ans = (r - l + 1) / 9 * 45;
			long long t = (r - l + 1) % 9;
			while(t--)
			{
				if(l % 9 == 0)
				{
					ans += 9;
				}
				else
				{
					ans += l % 9;
				}
				++l;
			}
			cout << ans << "\n";
		}
	}
}

Compilation message

trol.cpp:6:1: error: expected unqualified-id before 'int'
    6 | int main()
      | ^~~