2019-08-03 贪心四题

2019-08-03  本文已影响0人  saploser

P1190 接水问题

第一次提交,“不能定义time变量” ;修改变量名后,AC;为什么Dev-C里面没报错呢?
神奇的CE了,完全看不懂洛谷编译器显示的东西

/tmp/tmpjcx93_mx/src:7:17: 错误:‘int time [10010]’被重新声明为不同意义的符号
int time[NR + 10] ;
^
In file included from /usr/include/pthread.h:24,
from /usr/include/x86_64-linux-gnu/c++/8/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/8/bits/gthr.h:148,
from /usr/include/c++/8/ext/atomicity.h:35,
from /usr/include/c++/8/bits/ios_base.h:39,
from /usr/include/c++/8/ios:42,
from /usr/include/c++/8/ostream:38,
from /usr/include/c++/8/iostream:39,
from /tmp/tmpjcx93_mx/src:1:
/usr/include/time.h:75:15: 附注:previous declaration ‘time_t time(time_t)’
extern time_t time (time_t __timer) __THROW;
^~~~
/tmp/tmpjcx93_mx/src: 在函数‘int main()’中:
/tmp/tmpjcx93_mx/src:16:23: 警告:在算术表达式中使用了函数指针 [-Wpointer-arith]
scanf("%d" , &time[i]) ;
^
/tmp/tmpjcx93_mx/src:16:9: 警告:格式 ‘%d’ expects argument of type ‘int
’, but argument 2 has type ‘time_t (
)(time_t) throw ()’ {aka ‘long int ()(long int*)’} [-Wformat=]
scanf("%d" , &time[i]) ;
^~~~ ~~~~~~~~
/tmp/tmpjcx93_mx/src:26:25: 警告:在算术表达式中使用了函数指针 [-Wpointer-arith]
tap[tap_min] += time[i] ;

                     ^

/tmp/tmpjcx93_mx/src:26:16: 警告:在算术表达式中使用了函数指针 [-Wpointer-arith]
tap[tap_min] += time[i] ; ~~~~~~~~~~~~^~~~~~~~~
/tmp/tmpjcx93_mx/src:26:16: 错误:invalid conversion from ‘time_t ()(time_t) throw ()’ {aka ‘long int ()(long int)’} to ‘int’ [-fpermissive]


P2772 寻找平面上的极大点

本题成功AC,主体思路是每次找在剩余点中,y最大的点,之后排除掉所有x比他小的点即可。


P1095 守望者的逃离

本题A了8个点,2个点wa了,这种问题如何在做题时发现并解决?

P1970 花匠

感觉思路是对的,样例也过了,可提交上去全wa了

上一篇 下一篇

猜你喜欢

热点阅读