https://codeforces.com/contest/1228/problem/A
#include<iostream> #include<cstdio> using namespace std; int pd(int x) { int a[10] = {}; while(x) { if(a[x%10]) return 0; a[x%10]++; x /= 10; } return 1; } int main(){ int l,r; scanf("%d%d", &l, &r); for(int i = l; i <= r; i++) { if(pd(i)) { printf("%d\n", i); return 0; } } printf("-1\n"); return 0; }
/*
121 130
123
98766 100000
-1
*/
https://codeforces.com/contest/1228/problem/B
// solution to a problem such as the meaning of the questions simulation, computational not have to fill in the rest of the grid 2 ^ cnt (cnt little fast with no power will do) // But to judge at the time when the output cnt 0 1 // there when when conditions indicate a conflict there can be no output is 0 // tips or operational conditions can be a time when the conflict will be a larger value 3 #include <bits / STDC ++ H.> a using namespace std; // cf589div2b #define _for (I, A, B) for (int I = (A); I <(B); I ++) #define _rep (I, A, B) for (int I = (A); I <= (B); ++ I) #define LL Long Long const LL + 1E9 = MOD . 7 ; int L, R & lt, CNT = 0 ; int main () { // ios_base :: sync_with_stdio (0), cin.tie (0), cout.tie (0 ); scanf ( "%d%d", &l, &r); vector<vector<int> > f(l+5, vector<int>(r+5, 0)); _rep(i,1,l) { int k; scanf("%d", &k); _rep(j,1,k) f[i][j] |= 1; if(k+1 <= r) f[i][k+1] |= 2; } _rep(i,1,r) { int k; scanf("%d", &k); _rep(j,1,k) f[j][i] |= 1; if(k+1 <= l) f[k+1][i] |= 2; } ll ans = 1; _rep(i,1,l) _rep(j,1,r) if(!f[i][j]) ans *= 2, ans %= mod; _rep(i,1,l) _rep(j,1,r) if(f[i][j] == 3) ans *= 0; //if(!f[i][j] && i>=c[i] && j>=d[j]) cnt++; //printf("cnt = %d\n", cnt); printf("%lld\n", ans); return 0; } /* 3 4 0 3 1 0 2 3 0 output 2 1 1 0 1 output 0 19 16 16 16 16 16 15 15 0 5 0 4 9 9 1 4 4 0 8 16 12 6 12 19 15 8 6 19 19 14 6 9 16 10 11 15 4 output 2^47%mod = 487370169 797922655 == 2^51%mod */
https://codeforces.com/contest/1228/problem/C
The derivation of the equation it can be seen f (x, 1) * ...... * f (x, n) is the result of the prime factors p1 x * ...... * pk
1 * ...... * n x remove non-factor of prime factors remaining answer mode is 1e9 + 7, but the actual operation is relatively cumbersome
Product through a series of derivation (magic) can be obtained result is equal to pi ^ (n / pi) (i 1 ...... k) of
! N-th power of 2 x can be divided by x = 0; while (n> 0) {n / = 2, x + = n;} can be calculated from x, interesting (Section 4.4 factorial specific chapter number theory of mathematics related factors derived)
Other prime factor index Seeking Similarly, as follows
/* input 10 2 output 2 input 20190929 1605 output 363165664 input 947 987654321987654321 output 593574252 */ //vector<vector<int> > f(l+5, vector<int>(r+5, 0)); #include<bits/stdc++.h> using namespace std; #define ll long long const ll mod = (int)1e9+7; ll powmod(ll x, ll a){ if(a == 0) return 1; if(a & 1) return x*powmod(x, a-1)%mod; return powmod(x*x%mod, a/2)%mod; } int main(){ ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); ll x, n; cin >> x >> n; set<ll>your; for(int d = 2; d*d <= x; d++) while(x%d == 0) dv.insert(d), x /= d; if(x > 1) dv.insert(x); ll ans = 1; for(ll d : dv){ ll g = 0, r = n; while(r > 0) r /= d, g += r; ans *= powmod(d, g); ans %= mod; } return cout << (int)ans << '\n', 0; }