11111

Eric 阿蕾奇诺 2024-05-18 11:15:55 7
#include <bits/stdc++.h>

#define int long long

using namespace std;

int n;
int a[20][20];
int ans;

signed main()
{
	scanf("%lld",&n);
	for(int i = 1;i <= n;i ++)
	{
		int p,q;
		p = q = i;
		while(p > 0)
		{
			q = p;
			p /= 10;
		}
		a[q][i % 10] ++;
	}
	for(int i = 1;i <= 9;i ++)
	{
		ans += (a[i][i] - 1) * a[i][i] / 2;
		for(int j = i + 1;j <= 9;j ++)
		{
			ans += a[i][j] * a[j][i];
		}
	}
	printf("%lld",ans);
	return 0;
}
{{ vote && vote.total.up }}