第一题 金币
题目戳这—> https://www.luogu.com.cn/problem/P2669
思路:简单的模拟
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<vector>
#include<cmath>
using namespace std;
int main()
{
int n,t=0,sum=0;//t:天数
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
if(t+i<=n)
{
t+=i;
sum+=i*i;
continue;
}
sum+=(n-t)*i;
break;
}
printf("%d",sum);
return 0;
}
第二题 扫雷游戏
题目戳这—> https://www.luogu.com.cn/problem/P2670
思路:简单的模拟+1
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<vector>
#include<cmath>
using namespace std;
int main()
{
int n,m;
scanf("%d%d",&n,&m);
char c[n+2][m+2];
int a[n+2][m+2];
for(int i=0;