2019-08-03 貪心四題

P1190 接水問題

第一次提交,“不能定義time變量” ;修改變量名后,AC;為什么Dev-C里面沒報(bào)錯(cuò)呢?
神奇的CE了,完全看不懂洛谷編譯器顯示的東西

/tmp/tmpjcx93_mx/src:7:17: 錯(cuò)誤:‘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: 在函數(shù)‘int main()’中:
/tmp/tmpjcx93_mx/src:16:23: 警告:在算術(shù)表達(dá)式中使用了函數(shù)指針 [-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: 警告:在算術(shù)表達(dá)式中使用了函數(shù)指針 [-Wpointer-arith]
tap[tap_min] += time[i] ;

                     ^

/tmp/tmpjcx93_mx/src:26:16: 警告:在算術(shù)表達(dá)式中使用了函數(shù)指針 [-Wpointer-arith]
tap[tap_min] += time[i] ; ~~~~~~~~~~~~^~~~~~~~~
/tmp/tmpjcx93_mx/src:26:16: 錯(cuò)誤:invalid conversion from ‘time_t ()(time_t) throw ()’ {aka ‘long int ()(long int)’} to ‘int’ [-fpermissive]


P2772 尋找平面上的極大點(diǎn)

本題成功AC,主體思路是每次找在剩余點(diǎn)中,y最大的點(diǎn),之后排除掉所有x比他小的點(diǎn)即可。


P1095 守望者的逃離

本題A了8個(gè)點(diǎn),2個(gè)點(diǎn)wa了,這種問題如何在做題時(shí)發(fā)現(xiàn)并解決?

P1970 花匠

感覺思路是對的,樣例也過了,可提交上去全wa了

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容