#define lll __int128 #define ll long long ll (lll a, lll b, lll p) { lll s = 1; while (b) { if (b & 1) s = (s * a) % p; a = (a * a) % p; b >>= 1; } return (ll) s%p; } int main() { int t; ll a, b, p; scanf("%d", &t); while (t--) { scanf("%lld%lld%lld", &a, &b, &p); printf("%lldn", quick(a, b, p)); } return 0; }
#include<iostream> #include<cstdio> using namespace std; const int maxn=200005; int main(){ int n,k; while(scanf("%d%d",&n,&k)!=EOF){ int l[maxn]; for(int i=0;i<n;i++){ scanf("%d",&l[i]); }
int left=0,right=0x7fffffff; int mid; while((right-left)>1){ mid=(right+left)/2; int sum=0; for 大专栏牛客小白月赛12(int i=0;i<n;i++){ sum+=l[i]/mid; } if(sum>=k){ left=mid; }else{ right=mid; } } printf("%dn",left);
#include<cstdio> #include<algorithm> #define ll long long using namespace std; ll a,b,n; int main(){ while(scanf("%lld%lld%lld",&a,&b,&n)!=EOF){ printf("%lldn",__gcd(a,b)); }