牛客小白月賽25

2021-10-06 06:08:51 字數 2165 閱讀 9114

分情況討論

#include

using

namespace std;

const

int n =

2e5+5;

typedef

long

long ll;

int a[n]

;int

main

(void)if

(n <= x)

else

}printf

("%lld\n"

, ans)

;return0;

}

用字元陣列來模擬棧

#include

using

namespace std;

const

int n =

3e5+5;

char s[n]

, st[n]

;int

main

(void

)else}if

(idx !=-1

)else

return0;

}

水題

#include

using

namespace std;

const

int n =

2e5+5;

intmain

(void

)printf

("%.5lf %.5lf\n"

,(sum + m)

/ n,

(sum +

5* m)

/ n)

;return0;

}

水題

#include

using

namespace std;

char s[

1005];

int a[30]

;int

main

(void)}

for(

int i =

0; i <

26; i++)}

printf

("%c\n"

,'a'

+ idx)

;return0;

}

不得不說,此題在本菜雞能力範圍之外

因為double的精度問題,會導致死迴圈,需要使用long double

並且我的devcpp輸出long double型別的答案結果異常,可能是不支援吧

#include

using

namespace std;

typedef

long

double ld;

ld a, b, c;

ld f

(ld x)

intmain

(void

)printf

("%.7lf\n"

, l)

;return0;

}

用三個陣列,x, y, xy 分別儲存每一行的和,每一列的和,每乙個位置的和

最後要求的每個位置的和即為:x[i] + y[j] - xy[i][j]

因為沒有注意到 n * m < 1e6的條件,一直段錯誤,沒想到會在這裡挖坑qaq

#include

using

namespace std;

typedef

long

long ll;

const

int n =

1e6+5;

ll x[n]

, y[n]

, xy[n]

;int

main

(void)}

for(

int i =

0; i < n; i++

)puts(""

);}return0;

}

牛客小白月賽3

a 我們規定母音字母有a e i o u,並且規定半母音字母y也是母音字母。cwbc在學習英語,xhrlyb為了讓cwbc的記憶更加深刻,於是她讓cwbc把每個字串的所有字母都變成乙個恰好不大於它本身的小寫母音字母。可是cwbc比較貪玩,並且他想讓你幫他完成這個任務。聰明的你在仔細閱讀題目後,一定可...

牛客小白月賽6

c 挑花 dfs或bfs 桃花一簇開無主,可愛深紅映淺紅。題百葉桃花 桃花長在桃樹上,樹的每個節點有乙個桃花,調皮的htbest想摘盡可能多的桃花。htbest有乙個魔法棒,摘到樹上任意一條鏈上的所有桃花,由於htbest法力有限,只能使用一次魔法棒,請求出htbest最多可以摘到多少個桃花。第一行...

牛客小白月賽16

很容易得到n 1時,因為小石先手,所以小石一定輸 而n!1時,假設n 5 小石先取1 小陽取2 4 小石去3 小陽輸,無論怎樣小石都有贏的機會 includeusing namespace std int main 打表求出1 1e3之間的所有三角形每層之和 include define ll lo...