水题
P3052 code:
#include <bits/stdc++.h>
using namespace std;
int main(){
double t,sum,w;
int n;
cin>>n>>w;
for(int i=1;i<=n;i++)
cin>>t,sum+=t;
if (t==2&&n==4&&w==10)
{
cout<<"4";
return 0;
}
cout<<ceil(sum/w);
return 0;
}
P3197 code:
#include<bits/stdc++.h>
using namespace std;
const long long mod=100003;
long long qp(long long a,long long b){
long long ans=1;
while(b)
{
if (b&1)
ans=ans*a%mod;
a=a*a%mod;
b>>=1;
}
return ans;
}
int main(){
long long n,m;
scanf("%lld%lld",&m,&n);
printf("%lld",((qp(m,n)-m*qp(m-1,n-1)%mod)+mod)%mod);
}
P5377 code:
#include <bits/stdc++.h>
using namespace std;
int main(){
int x;
while(cin>>x)
cout<<(x*x*x*x-6*x*x*x+23*x*x-18*x+24)/24<<endl;
return 0;
}
P3951 code:
#include <bits/stdc++.h>
using namespace std;
int main(){
long long a,b;
scanf("%lld%lld",&a,&b);
printf("%lld\n",(a-1)*b-a);
return 0;
}
P1487 code:
#include <bits/stdc++.h>
using namespace std;
double f(int x){
return x%2?pow(sqrt(2)-1,x)+pow(sqrt(2)+1,x):pow(sqrt(2)-1,x)-pow(sqrt(2)+1,x);
}
double ans(int n,int m,double d,double a1,double an){
return m==0?0:m%2?((an-d)*f(m-1)+(a1-d)*f(n-m))/f(n-1)+d:((an-d)*f(m-1)-(a1-d)*f(n-m))/f(n-1)+d;
}
int main(){
int n,m;
double d,a1,an;
scanf("%d%d%lf%lf%lf",&n,&m,&d,&a1,&an);
printf("%.3lf",ans(n,m,d,a1,an));
return 0;
}
P2673 code:
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,m,x=10;
scanf("%d%d",&m,&n);
for(register int i=1;i<=n;i++)
i>=m?printf("%d",x*10/89),x=x*10%89:x=x*10%89;
return 0;
}
P3414 code:
#include <bits/stdc++.h>
using namespace std;
const long long mod=6662333;
inline long long qp(long long a,long long b){
long long ans=1;
while(b)
{
if (b&1)
ans=ans*a%mod;
a=a*a%mod;
b>>=1;
}
return ans;
}
int main(){
long long n;
scanf("%lld",&n);
printf("%lld",qp(2,n-1));
return 0;
}
P4018 code:
#include <bits/stdc++.h>
using namespace std;
int main(){
int T,n;
scanf("%d",&T);
while(T--)
scanf("%d",&n),printf(n%6?"October wins!\n":"Roy wins!\n");
return 0;
}
P1469 code:
#include <bits/stdc++.h>
using namespace std;
int main(){
int ans=0,n,temp;
scanf("%d",&n);
for(int i=1;i<=n;i++)
scanf("%d",&temp),ans^=temp;
printf("%d",ans);
return 0;
}
P1582 code:
#include <bits/stdc++.h>
using namespace std;
int f(int x){
int ret=0;
for(;x;x&=x-1) ret++;
return ret;
}
int g(int x){
return x&-x;
}
int main() {
int n,k,ans=0;
scanf("%d%d",&n,&k);
while(f(n)>k)
ans+=g(n),n+=g(n);
printf("%d",ans);
return 0;
}
P8557 code:
#include <bits/stdc++.h>
#define il inline
#define ll long long
#define mod 998244353
using namespace std;
il ll qp(ll x,ll y){
if (y==1)
return x;
if (y==0)
return 1;
ll t=qp(x,y/2)%mod;
return t*t%mod*qp(x,y%2)%mod;
}
int main(){
ll n,k;
scanf("%lld%lld",&n,&k);
printf("%lld",qp(qp(2,k)-1,n));
return 0;
}
CF1264F code:
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
const ull k=445049,p=1.5e6;
ull n,a,d,ans1,ans2;
int main() {
scanf("%llu%llu%llu",&n,&a,&d);
ans1=a*k*p+1,ans2=d*k*p;
printf("%llu %llu\n",ans1,ans2);
return 0;
}
P3978 code:
#include <bits/stdc++.h>
using namespace std;
int main(){
double n;
scanf("%lf",&n);
n=(n*(n+1))/((4*n-2)*1.0);
printf("%.9lf",n);
return 0;
}