Submission #19387

#TimeUsernameProblemLanguageResultExecution timeMemory
19387camilleΣ (kriii4_P2)C++98
0 / 100
62 ms1716 KiB
#include <iostream> using namespace std; typedef long long lld; lld a,x,mod=1e9+7,t; lld foo(lld idx){ if(idx==1) return a; lld k = foo(idx/2)%mod; if(idx%2) return (((k*k)%mod)*a)%mod; return (k*k)%mod; } int main(){ cin>>t; while(t--){ cin>>a>>x; cout<<(x*foo(mod-2))%mod<<endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...