90分,是不是爆了???

P1401 [入门赛 #18] 禁止在 int 乘 int 时不开 long long

@[not_much](/user/1189340) `int` 的范围是 $[-2147483648,2147483647]$,并不是 $[-2147483647,2147483647]$。
by 2021zjhs005 @ 2024-01-08 18:02:26


@[2021zjhs005](/user/1121995) 还是90分 ```cpp #include<bits/stdc++.h> using namespace std; int main(){ long long int x1,y1,x2,y2; cin>>x1>>y1>>x2>>y2; if(x1*y1>2147483647||x1*y1<-2147483648||x2*y2>2147483647||x2*y2<-2147483648){ cout<<"long long int"<<endl; }else{ cout<<"int"<<endl; } return 0; } ```
by not_much @ 2024-01-08 18:11:05


@[not_much](/user/1189340) HACK: ``` -100000000 1 -1 100000000 ```
by xiaoshumiao @ 2024-01-08 18:13:37


@[xiaoshumiao](/user/1008513) 本人弱鸡,请问hack是什么意思???
by not_much @ 2024-01-08 18:15:48


@[not_much](/user/1189340) 你这个交叉乘法都不对。 ``` x1 y1 x2 y2 所以是 x1*x2,x1*y2,y1*x2,y1*y2。 你上面的错了,所以有 HACK。 ``` 附:HACK。比如应该输出 $x$,而你的程序输出 $y$,结果不符,称为你的程序被 HACK 了,也就是有不对的数据。
by 2021zjhs005 @ 2024-01-08 18:34:30


@[not_much](/user/1189340) 就是你的代码会 WA/RE/TLE/MLE 的一种数据。
by xiaoshumiao @ 2024-01-08 18:34:32


@[2021zjhs005](/user/1121995) 现在97 ```cpp #include<bits/stdc++.h> using namespace std; int main(){ long long int x1,y1,x2,y2; cin>>x1>>y1>>x2>>y2; if(x1*y1>2147483647||x1*y1<-2147483648||x2*y2>2147483647||x2*y2<-2147483648||x1*x2>2147483648||x1*x2<-2147483648||y1*y2>2147483648||y2*y2<-2147483648||x1*y2>2147483648||x1*y2<-2147483648||x2*y1>2147483648||x2*y1<-2147483648){ cout<<"long long int"<<endl; }else{ cout<<"int"<<endl; } return 0; } ```
by not_much @ 2024-01-09 17:52:51


@[not_much](/user/1189340) 你的 `if()` 有多余的不是交叉相乘的,应该去掉。 然后后可能会有漏掉的再补上。
by 2021zjhs005 @ 2024-01-09 18:34:49


@[2021zjhs005](/user/1121995) AC了,谢谢
by not_much @ 2024-01-10 18:06:27


|