CCF小明種蘋果

2021-10-07 18:37:50 字數 537 閱讀 5492

想必大家是在這個題上出來問題才來找解答的,題目是什麼大家應該都清楚,就不再敘述了。

這個題沒什麼難度,主要是在乙個細節上要注意:

千萬不要在函式裡定義二維陣列

第9,10個資料,當n和m同時為1000時,二維陣列是不能承受的。

乙個1000x1000的int陣列大概是4m左右,定義這樣的陣列就會報錯。

這裡提供的解決方案是定義一維陣列,因為輸入的資料只用了一次,所以覆蓋掉也沒什麼問題。

要講的就這麼多,有什麼問題可以提問。

下面是**

#include

using

namespace std;

intmain()

count+

=x[0

]-c;

if(c>max)

}

cout<" "<" "<'\n'

;return0;

}

CCF 小明種蘋果(續)

def check temp flag false 設定乙個標記 如果出現掉落的情況 標記設為true drop 0 pre temp 1 for i in range 2,len temp if temp i 0 currenttotal temp i if pre drop currenttot...

CCF 小明種蘋果(續)

題目描述 小明在他的果園裡種了一些蘋果樹,這些蘋果樹排列成乙個圓。為了保證蘋果的品 質,在種植過程中要進行疏果操作。為了更及時地完成疏果操作,小明會不時地檢查每棵樹的狀態,根據需要進行疏果。檢查時,如果發現可能有蘋果從樹上掉落,小明會重新統計樹上的蘋果個數 然後根據之前的記錄就可以判斷是否有蘋果掉落...

CCF 201909 1 小明種蘋果

include include include include using namespace std const int n 1000 10 int a n b n int main int max 0,ans 0,sum 0 for int i 0 i n i for int i 0 i m i...