牛客小白月賽16

2021-09-25 05:41:12 字數 1283 閱讀 8549

很容易得到n==1時,因為小石先手,所以小石一定輸

而n!=1時,假設n=5 小石先取1 小陽取2 4 小石去3 小陽輸,無論怎樣小石都有贏的機會

#includeusing namespace std;

int main()

打表求出1~1e3之間的所有三角形每層之和

#include#define ll long long

using namespace std;

const int maxn = 1005;

const int mod = 1e9+7;

ll a[maxn][maxn];

ll sum[maxn];

int main()

printf("%lld\n",s);

}}

每一次標記消去小於水位的海島,統計連續的小島

#includeusing namespace std;

const int maxn = 1005;

int a[maxn];

int flag[maxn];

int main()

for(int i=0;i>t;

for(int j=0;jusing namespace std;

int main()

if(sum>0) printf("%d\n",n);

else if(ans==-1) printf("0\n");

else printf("%d\n",ans);

}

爆搜

#includeusing namespace std;

int a[10][10];

int n,cnt;

mapmp;

void dfs(int row,int col,int sum)

}if(row==n+1||col==n+1) return;

dfs(row+1,col,sum+a[row][col]);

dfs(row,col+1,sum+a[row][col]);

}int main()

}dfs(1,1,0);

printf("%d\n",cnt);

}

#includeusing namespace std;

const double pi = 3.1415926535898;

int main()

牛客小白月賽16總結

恢復內容開始 很失敗的一次,主要是被pi的精度卡了?小雨的矩陣 dfs include include include include include include include include include using namespace std typedef long long ll d...

牛客小白月賽3

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

牛客小白月賽6

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