首页 > 其他分享 >Codeforces 1360 E. Polygon

Codeforces 1360 E. Polygon

时间:2023-02-03 11:32:39浏览次数:40  
标签:&& Polygon puts int rep Codeforces flag 1360 100


Codeforces 1360 E. Polygon_ci


Codeforces 1360 E. Polygon_ci_02

题意:

在一个 Codeforces 1360 E. Polygon_ci_03 的网格上方和左边都有一排大炮,每次可以发射一个 Codeforces 1360 E. Polygon_ci_04 ,遇到边界和 Codeforces 1360 E. Polygon_ci_04 都会停下来,有没有一种发射频率可以组成给出的 Codeforces 1360 E. Polygon_ci_06

大炮的位置在左和上,所以每个非右边界或者下边界的 Codeforces 1360 E. Polygon_ci_04 的右方或者下方都会有一个 Codeforces 1360 E. Polygon_ci_04

AC代码:

int n, m, k;
char a[100][100];
int main()
{
int t;
sd(t);
while (t--)
{
sd(n);
rep(i, 1, n)
{
rep(j, 1, n)
cin >>
a[i][j];
}
bool flag = 1;
rep(i, 1, n-1)
{
rep(j, 1, n-1)
{
if (a[i][j] == '1' && a[i + 1][j] != '1' && a[i][j + 1] != '1')
{
flag = 0;
break;
}
}
}
if (flag)
puts("YES");
else
puts("NO");
}
return 0;
}


标签:&&,Polygon,puts,int,rep,Codeforces,flag,1360,100
From: https://blog.51cto.com/u_15952369/6035736

相关文章

  • Codeforces 1358 C. Celex Update
    题意:一个矩形内有多个方格,每个方格都按照顺序填写了一些数。给两个坐标,求这两个坐标间路径经过的数字和不同的路线总数。可以看出比如要从走到,这两种走法和第二个比......
  • Codeforces 1354 D. Multiset(树状数组)
    题意;要你实现一个求第k大数的数据结构。树状数组模板题。AC代码:constintN=1e6+50;inta[N];intn,q;voidadd(intp,intval){while(p<=n){a[p]+=va......
  • codeforces 580C Kefa and Park (树上DFS)
    Description:Kefadecidedtocelebratehisfirstbigsalarybygoingtotherestaurant.Helivesbyanunusualpark.Theparkisarootedtreeconsistingof n ve......
  • CodeForces - 253E Table with Letters - 2
    Description:Let'sconsideranetworkprinterthatfunctionslikethat.Itstartsworkingattime0.Ineachseconditcanprintonepageofatext.Atsomemomen......
  • Codeforces1201 B Maximum Median (二分)
    Description:Youaregivenanarray aa of nn integers,where nn isodd.Youcanmakethefollowingoperationwithit:Chooseoneoftheelementsofthearray......
  • Codeforces Round #596 D
    找到a[i]*a[j]=x^k符合这个式子的有多少种组合。分解质因子来做就行了AC代码:#include<cstdio>#include<cstring>#include<iostream>#include<algorithm>#include<s......
  • Codeforces-343D Water Tree(树链剖分)
    Description:MadscientistMikehasconstructedarootedtree,whichconsistsof n vertices.Eachvertexisareservoirwhichcanbeeitheremptyorfilledw......
  • Codeforces Round #596 B2. TV Subscriptions
    题意就是让你在N个数中找到D个连续的数,使这D个数中不同的数最小。hard数据较大,优化到nlogn才能过。具体怎么优化看代码吧AC代码:#include<cstdio>#include<cstring>......
  • Codeforces Round #596 C. p-binary
    给定N和p,让你找到满足2^x+p最少有多少不同的项。就把N转成二进制然后枚举P的个数就是答案,昨天特判没写好,今天早上起来发现被卡掉了。rank又出1000了。AC代码:#include<......
  • Educational Codeforces Round 75 D. Salary Changing(二分)
    题意就是:给n个人发工资,总钱数为s。每个人有一个工资范围。要求一个发工资方案,使得工资中位数最大,求这个中位数。考虑到中位数最大,于是我们可以二分。但是每个人的工资......