各位大佬,感觉逻辑没问题,帮忙看看为什么运行会直接结束,连输入都没输入就结束了

P1161 开灯

@[songyikang](/user/412341) 不知道为什么,你可能在输入 $t$ 的时候精度炸掉了,因为第二个数是 `int` 的。 其实本题可以简化,我们可以发现,其实就是一道数学题,不需要统计的。 代码仅供参考: ```cpp #include<bits/stdc++.h> using namespace std; int n, t, ans; double a; map <int, int> f; int main() { scanf ("%d", &n); for (int i = 0; i < n; ++ i) { scanf ("%lf %d", &a, &t); for (double j = 1; j <= t; ++ j)ans ^= int (j * a); } printf ("%d", ans); return 0; } ```
by Y_QWQ_Y @ 2024-01-19 23:23:35


@[Y_QWQ_Y](/user/677091) 好的谢谢佬
by songyikang @ 2024-01-20 09:43:18


# ~~**~~******~~ _ ------------ ~~** _** _** _** ------------ ~~ ------------ ****~~**_ **_ **_ **~~_ ~~******~~**~~
by S_mz @ 2024-02-21 08:52:25


数组长度过大,导致内存溢出,c语言的数组虽然理论上来说使用的是虚拟内存可以无限接近于你的机器的最大无符号整型的长度,但是当数组长度大于1000000会导致内存溢出。
by qb1337 @ 2024-03-06 21:44:39


|