帅气的wzy叫我来写
今日110分,真好玩,离第一名仅仅剩120分
第一题弱智题(亏我推了这么久)
直接上AC代码
#include<bits/stdc++.h>
using namespace std;
int main(){
freopen("chocolate.in","r",stdin);
freopen("chocolate.out","w",stdout);
ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int t,n,m;
cin>>t;
for(int ii=1;ii<=t;ii++){
cin>>n>>m;
if(n==1&&m==1) cout<<"Jane\n";
else cout<<"January\n";
}
return 0;
}
第二题贝祖定理+拓展欧几里得算法,C++不会实现
但是啊但是,题目有可以不交换的条件,所以可以骗到10分……
然后,投诉,这道题题解编译过不了!!!(老师说我没开C++14……)
第三题概率DP,考试爆零,在老师的讲解和题解的帮助下顺利AC
顺便提一嘴,如果直接cout<<e[n]<<"\n"
或者cout<<e[n]<<endl
貌似过不了(反正我过不了)
目前好像只有printf("%.10f\n",e[n])
和cout<<setprecision(10)<<fixed<<e[n]<<endl
能过
下附改后AC代码
#include<bits/stdc++.h>
using namespace std;
int t;
double e[200002];
int main(){
freopen("magic.in","r",stdin);
freopen("magic.out","w",stdout);
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin>>t;
for(int ii=1;ii<=t;ii++){
int n,m,p,q;
cin>>n>>m>>p>>q;
double p1=p*1.0/100,q1=q*1.0/100;
for(int i=0;i<=n;i++){
e[i]=0;
}
for(int i=m;i<=n;i++) {
e[i]=1+p1+e[i-m];
if(m!=1){
e[i]=max(e[i],1+q1*e[i-m+1]+(1-q1)*e[i-m]);
}
else{
e[i]=max(e[i],1/(1-q1)+e[i-1]);
}
}
cout<<setprecision(10)<<fixed<<e[n]<<endl;
//printf("%.10f\n",e[n]);
}
return 0;
}
第四题,字符串哈希
不会,爆零,没改
总结
今天学习了一下哈希的模板,但是因为没学指针(我学的那版有指针)学不懂,
主要学了一下快速输入的代码(还被wzy嘲讽了),如下
//急速读入模板,但是读入最大18446744073709551615而且不能有字符
//最大的弊端:必须全部是自然数!!!
#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
ull n;
inline void read(ull& a){
ull s=0,w=1;
char ch=getchar();
while(ch<'0'||ch>'9'){
if(ch=='-'){
w=-1;
}
ch=getchar();
}
while(ch>='0'&&ch<='9'){
s=s*10+ch-'0';
ch=getchar();
}
a=s*w;
}
int main(){
read(n);
cout<<n;
return 0;
}
(主要是为了明天的考试!!!)
好了,各位,明日再见!