T1-乘方
细节处理花了不少时间,最后提交太匆忙,语言选错了,(大悲)。 Code:
#include<iostream>
//#include<cstdlib>
#define int unsigned long long
#define inf 1e9
using namespace std;
int a,b,ans=1;
inline void work(){
if(a==1){
cout<<1;
exit(0);
}
if(a>inf||b>inf){
cout<<-1;
exit(0);
}
for(int i=1;i<=b;i++){
ans*=a;
if(ans>inf){
cout<<-1;
exit(0);
}
}
}
signed main(){
// freopen("pow.in","r",stdin);
// freopen("pow.out","w",stdout);
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
cin>>a>>b;
work();
cout<<ans;
// fclose(stdin);
// fclose(stdout);
}T2-解密
一道数学题,推式子推了很久,AC。 Code:
#include<iostream>
#include<cmath>
//#include<cstdlib>
#define int unsigned long long
using namespace std;
signed main(){
// freopen("decode.in","r",stdin);
// freopen("decode.out","w",stdout);
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
int t;
cin>>t;
while(t--){
int n,d,e;
cin>>n>>d>>e;
int a=n-d*e+2;
int b=sqrt((a*a)-4*n);
int p=(a-b)/2;
int q=(a+b)/2;
if(p*q==n&&(p-1)*(q-1)+1==e*d&&p>0&&q>0)cout<<p<<' '<<q<<'\n';
else cout<<"NO\n";
}
// fclose(stdin);
// fclose(stdout);
}T3-逻辑表达式
恶心的大模拟,细节特别多,死活调不出来,于是选择骗分,观察样例,发现第 个点数据极小,可以打表,但是考虑不周少 A 了一个点,。 Code:
#include<iostream>
//#include<cstdlib>
using namespace std;
signed main(){
// freopen("expr.in","r",stdin);
// freopen("expr.out","w",stdout);
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
string s;
cin>>s;
if(s=="0&0"||s=="(0&0)")cout<<"0\n1 0";
else if(s=="0&1"||s=="(0&1)")cout<<"0\n1 0";
else if(s=="1&1"||s=="(1&1)")cout<<"1\n0 0";
else if(s=="1&0"||s=="(1&0)")cout<<"0\n0 0";
else if(s=="0|0"||s=="(0|0)")cout<<"0\n0 0";
else if(s=="0|1"||s=="(0|1)")cout<<"1\n0 0";
else if(s=="1|1"||s=="(1|1)")cout<<"1\n0 1";
else if(s=="1|0"||s=="(1|0)")cout<<"1\n0 1";
else if(s=="0&0&0")cout<<"0\n2 0";
else if(s=="0&0&1")cout<<"0\n2 0";
else if(s=="0&1&0")cout<<"0\n2 0";
else if(s=="1&0&0")cout<<"0\n1 0";
else if(s=="0&1&1")cout<<"0\n2 0";
else if(s=="1&0&1")cout<<"0\n1 0";
else if(s=="1&1&0")cout<<"0\n0 0";
else if(s=="1&1&1")cout<<"1\n0 0";
else if(s=="0&0|0")cout<<"0\n1 0";
else if(s=="0&0|1")cout<<"1\n1 0";
else if(s=="0&1|0")cout<<"0\n1 0";
else if(s=="1&0|0")cout<<"0\n0 0";
else if(s=="0&1|1")cout<<"1\n1 0";
else if(s=="1&0|1")cout<<"1\n0 0";
else if(s=="1&1|0")cout<<"1\n0 1";
else if(s=="1&1|1")cout<<"1\n0 1";
else if(s=="0|0|0")cout<<"0\n0 0";
else if(s=="0|0|1")cout<<"1\n0 0";
else if(s=="0|1|0")cout<<"1\n0 1";
else if(s=="1|0|0")cout<<"1\n0 2";
else if(s=="0|1|1")cout<<"1\n0 1";
else if(s=="1|0|1")cout<<"1\n0 2";
else if(s=="1|1|0")cout<<"1\n0 2";
else if(s=="1|1|1")cout<<"1\n0 2";
else if(s=="0|0&0")cout<<"0\n1 0";
else if(s=="0|0&1")cout<<"0\n1 0";
else if(s=="0|1&0")cout<<"0\n0 0";
else if(s=="1|0&0")cout<<"1\n1 1";
else if(s=="0|1&1")cout<<"1\n0 0";
else if(s=="1|0&1")cout<<"1\n1 1";
else if(s=="1|1&0")cout<<"1\n0 1";
else if(s=="1|1&1")cout<<"1\n0 1";
else cout<<"0\n 0 0";
// fclose(stdin);
// fclose(stdout);
}T4-上升点列
一眼动规,但是时间只剩 ,尝试无果,摆烂骗分,不过数据确实水,拿了 (最后只剩 提交,导致语言选错悲剧)。 Code:
#include<iostream>
//#include<cstdlib>
using namespace std;
signed main(){
// freopen("point.in","r",stdin);
// freopen("point.out","w",stdout);
int n;
cin>>n;
cout<<n;
// fclose(stdin);
// fclose(stdout);
}Ending
期望得分:
实际得分:
(大悲)……