yn_ko_86 @ 2024-11-29 19:49:42
p1401
#include<bits/stdc++.h>
using namespace std;
int main(){
long long a,b,c,d;
cin>>a>>b>>c>>d;
if(b*c>=2147483647||a*d<=-2147483648||b*c<=-2147483648||b*d>=2147483647)cout<<"long long int";
else cout<<"int";
return 0;
}
悬一关
by LJXlalala @ 2024-11-29 19:54:34
@yn_ko_86 你把他们全部判一遍
by Harlem @ 2024-11-29 19:55:28
首先我认为你需要去掉等号
其次我认为最好把八种情况全部列上去。负负得正。
前一个改正后99,后一个我没试。
考前攒RP
by yn_ko_86 @ 2024-11-29 19:56:42
@Harlem@Harlem现在就是99
by Harlem @ 2024-11-29 19:58:09
@yn_ko_86加个负负得正就过了。
#include<bits/stdc++.h>
using namespace std;
int main(){
long long a,b,c,d;
cin>>a>>b>>c>>d;
if(b*c>2147483647||a*d<-2147483648||b*c<-2147483648||b*d>2147483647||a*c>INT_MAX)cout<<"long long int";
else cout<<"int";
return 0;
}
by yn_ko_86 @ 2024-11-29 19:59:21
@Harlem谢,关了
by LJXlalala @ 2024-11-29 20:00:35
@yn_ko_86而且不要取等,第一个
by LJXlalala @ 2024-11-29 20:01:25
#include<bits/stdc++.h>
using namespace std;
long long maxn=2147483647,minn=-2147483648;
int main(){
long long a,b,c,d;
cin>>a>>b>>c>>d;
if(a*c>maxn||a*d<minn||b*c<minn||b*d>maxn) cout<<"long long int";
else cout<<"int";
return 0;
}
@yn_ko_86
by LJXlalala @ 2024-11-29 20:01:58
神奇了,为什么判四种就过了