Olympiad
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Olympiad相关的知识,希望对你有一定的参考价值。
InputThe first line of the input is a single integer T (T≤1000)T (T≤1000), indicating the number of testcases.
For each test case, there are two numbers aa and bb, as described in the statement. It is guaranteed that 1≤a≤b≤1000001≤a≤b≤100000.
OutputFor each testcase, print one line indicating the answer.
Sample Input
2 1 10 1 1000
Sample Output
10 738
#include<iostream> #include<cstdio> #include<cstring> #include<string> #include<set> #include<vector> #include<stack> #include<queue> #include<algorithm> #include<cstdio> #include<algorithm> #include<functional> #include<sstream> using namespace std; int s[100001]; int main() { memset(s, 0, sizeof(s)); int flag[10]; for (int i = 1; i <= 100000; i++) { int j = i; s[i] = 1; memset(flag, 0, sizeof(flag)); while (j) { flag[j % 10]++; if (flag[j % 10] > 1)s[i] = 0; j /= 10; } s[i] += s[i - 1]; } int l, r; int t; scanf("%d", &t); while (t--) { scanf("%d%d", &l, &r); printf("%d\n", s[r] - s[l - 1]); } return 0; }
以上是关于Olympiad的主要内容,如果未能解决你的问题,请参考以下文章
Codeforces Round #626 (Div. 2, based on Moscow Open Olympiad in Informatics)
Codeforces Round #775 (Div. 2,based on Moscow Open Olympiad in Informatics) - D. Integral Array - 题解
codeforces730I Olympiad in Programming and Sports(姿势题 优先队列?dp?)
Codeforces Round #507 (Div. 2, based on Olympiad of Metropolises) APalindrome Dance