A:签到。我wa了一发怎么办啊。
#include
using namespace std;
#define ll long long
#define inf 1000000010
char getc(){char c=getchar();while ((c<'A'||c>'Z')&&(c<'a'||c>'z')&&(c<'0'||c>'9')) c=getchar();return c;}
int gcd(int n,int m){return m==0?n:gcd(m,n%m);}
int read()
{
int x=0,f=1;char c=getchar();
while (c<'0'||c>'9') {if (c=='-') f=-1;c=getchar();}
while (c>='0'&&c<='9') x=(x<<1)+(x<<3)+(c^48),c=getchar();
return x*f;
}
signed main()
{
int n=read();
cout<<(n-2)*180;
return 0;
//NOTICE LONG LONG!!!!!
}
B:签到。
#include
using namespace std;
#define ll long long
#define inf 1000000010
char getc(){char c=getchar();while ((c<'A'||c>'Z')&&(c<'a'||c>'z')&&(c<'0'||c>'9')) c=getchar();return c;}
int gcd(int n,int m){return m==0?n:gcd(m,n%m);}
int read()
{
int x=0,f=1;char c=getchar();
while (c<'0'||c>'9') {if (c=='-') f=-1;c=getchar();}
while (c>='0'&&c<='9') x=(x<<1)+(x<<3)+(c^48),c=getchar();
return x*f;
}
char s[20];
signed main()
{
scanf("%s",s+1);
int cnt=0;
for (int i=1;i<=strlen(s+1);i++) if (s[i]=='x') cnt++;
if (cnt>=8) cout<<"NO";else cout<<"YES";
return 0;
//NOTICE LONG LONG!!!!!
}
C:考虑枚举最后两人各胜多少局。注意到期望每100/(100-C)局就会决出一次胜负,于是只需要考虑该种胜负局数出现概率。不妨设第一个人赢了n场输了x场,那么概率就是C(n+x-1,n-1)·An·Bx/(A+B)n+x,累加即可。
#include
using namespace std;
#define ll long long
#define inf 1000000010
#define N 100010
#define P 1000000007
char getc(){char c=getchar();while ((c<'A'||c>'Z')&&(c<'a'||c>'z')&&(c<'0'||c>'9')) c=getchar();return c;}
int gcd(int n,int m){return m==0?n:gcd(m,n%m);}
int read()
{
int x=0,f=1;char c=getchar();
while (c<'0'||c>'9') {if (c=='-') f=-1;c=getchar();}
while (c>='0'&&c<='9') x=(x<<1)+(x<<3)+(c^48),c=getchar();
return x*f;
}
int n,A,B,C,f[1000][1000],fac[N<<1],Inv[N<<1],ans;
int ksm(int a,int k)
{
int s=1;
for (;k;k>>=1,a=1ll*a*a%P) if (k&1) s=1ll*s*a%P;
return s;
}
int inv(int a){return ksm(a,P-2);}
void inc(int &x,int y){x+=y;if (x>=P) x-=P;}
int calc(int n,int m){if (m>n) return 0;return 1ll*fac[n]*Inv[m]%P*Inv[n-m]%P;}
signed main()
{
n=read(),A=read(),B=read(),C=read();A=1ll*A*inv(100-C)%P,B=1ll*B*inv(100-C)%P;
fac[0]=1;for (int i=1;i<=2*n;i++) fac[i]=1ll*fac[i-1]*i%P;
Inv[0]=Inv[1]=1;for (int i=2;i<=2*n;i++) Inv[i]=P-1ll*(P/i)*Inv[P%i]%P;
for (int i=2;i<=2*n;i++) Inv[i]=1ll*Inv[i]*Inv[i-1]%P;
for (int i=0;i
D:大胆猜想从小到大填每次选(未被占用)度数最小的点即可。
#include
using namespace std;
#define ll long long
#define inf 1000000010
#define N 10010
char getc(){char c=getchar();while ((c<'A'||c>'Z')&&(c<'a'||c>'z')&&(c<'0'||c>'9')) c=getchar();return c;}
int gcd(int n,int m){return m==0?n:gcd(m,n%m);}
int read()
{
int x=0,f=1;char c=getchar();
while (c<'0'||c>'9') {if (c=='-') f=-1;c=getchar();}
while (c>='0'&&c<='9') x=(x<<1)+(x<<3)+(c^48),c=getchar();
return x*f;
}
int n,p[N],a[N],degree[N],val[N],t,ans;
struct data{int to,nxt;
}edge[N<<1];
void addedge(int x,int y){t++;edge[t].to=y,edge[t].nxt=p[x],p[x]=t;}
signed main()
{
n=read();
for (int i=1;i
E:每一项都除掉d。特判d=0。无所事事了1h后在最后20s想到了做法。
#include
using namespace std;
#define ll long long
#define inf 1000000010
#define P 1000003
char getc(){char c=getchar();while ((c<'A'||c>'Z')&&(c<'a'||c>'z')&&(c<'0'||c>'9')) c=getchar();return c;}
int gcd(int n,int m){return m==0?n:gcd(m,n%m);}
int read()
{
int x=0,f=1;char c=getchar();
while (c<'0'||c>'9') {if (c=='-') f=-1;c=getchar();}
while (c>='0'&&c<='9') x=(x<<1)+(x<<3)+(c^48),c=getchar();
return x*f;
}
int Q,fac[P],inv[P];
int ksm(int a,int k)
{
int s=1;
for (;k;k>>=1,a=1ll*a*a%P) if (k&1) s=1ll*s*a%P;
return s;
}
int I(int a){return ksm(a,P-2);}
signed main()
{
Q=read();
fac[0]=1;for (int i=1;i=P) printf("%d\n",0);
else printf("%d\n",1ll*fac[x+n-1]*(x==0?1:inv[x-1])%P*ksm(d,n)%P);
}
return 0;
//NOTICE LONG LONG!!!!!
}
result:rank 191 rating +9