关闭

codeforces 7 A. Kalevitch and Chess

488人阅读 评论(0) 收藏 举报
分类:

题目链接:http://codeforces.com/contest/7/problem/A
以前写的时候写的有点不是很好有点麻烦,看了一些大牛们的思路后感觉自己以前的代码真是弱爆了。
AC代码如下:

#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
char s[10][10];
int main()
{
    char s1[8];
    int sum=0;
    strcpy(s1,"BBBBBBBB");
    for(int i=0; i<8; i++)
    {
        cin>>s[i];
        if(strcmp(s[i],s1) == 0)
            sum++;
    }
    //cout<<sum<<endl;
    if(sum < 8)
    {
        for(int i=0; i<8; i++)
        {
            int f=0;
            for(int j=0; j<8; j++)
            {
                 if(s[j][i] == 'W')
                 {
                     //sum++;
                     f=1;
                     break;
                 }
            }
            if(!f)
                sum++;
        }
        cout<<sum<<endl;
    }
    else
        cout<<8<<endl;
    return 0;
}
0
0
查看评论
发表评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场

A. Kalevitch and Chess【思维】

A. Kalevitch and Chess time limit per test 2 seconds memory limit per test 64 megabytes input standard input output standard o...
  • liuke19950717
  • liuke19950717
  • 2016-06-19 12:03
  • 160

CF 7A——比赛A Kalevitch and Chess

A famous Berland's painter Kalevitch likes to shock the public. One of his last obsessions is chess. For more than a thousand years people have be...
  • u010857889
  • u010857889
  • 2014-03-27 21:52
  • 652

CodeForces 7A - Kalevitch and Chess

数学题,计算画几次能画出要求的图形。#include #include #include #include #include #include #include #include #include #include #include #include #include #i...
  • MrSiz
  • MrSiz
  • 2015-08-26 23:26
  • 225

CodeForces 7A Kalevitch and Chess

1、http://codeforces.com/problemset/problem/7/A 2、题目: A. Kalevitch and Chess time limit per test 2 seconds memory limit per test 64...
  • sdjzping
  • sdjzping
  • 2014-03-29 11:28
  • 938

CodeForces - 7A Kalevitch and Chess(搜索?!模拟!)

Kalevitch and Chess Time Limit: 2000MS   Memory Limit: 65536KB   64bit IO Format: %I64d & %I64u S...
  • hurmishine
  • hurmishine
  • 2016-06-08 20:20
  • 2057

N后问题 Java版

/* //* * N皇后问题Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 14577 Accepted Submissio...
  • newmemory
  • newmemory
  • 2015-12-07 21:11
  • 438

CodeForces 7A Kalevitch and Chess

A famous Berland's painter Kalevitch likes to shock the public. One of his last obsessions is chess. For more than a thousand years people have be...
  • ahoon
  • ahoon
  • 2015-04-01 18:53
  • 160

CodeForces 7A Kalevitch and Chess

思路:水题 #include using namespace std; string s; int vis[10][10]; int main() { int ans1=0,ans2=10; for(int i=1;i<=8;i++) { c...
  • qq_21057881
  • qq_21057881
  • 2016-04-08 17:01
  • 334

Hihocoder 1424 Asa's Chess Problem (有源汇上下界最小费用流)

ProblemAsa comes up with a chess problem. There are N×N chesses on a board with N×N grids, one chess in one grid. Some chesses are black whi...
  • DorMOUSENone
  • DorMOUSENone
  • 2017-07-17 12:55
  • 1072

noip2010 引水入城 (bfs染色+贪心)

P1777引水入城 Accepted 标签:动态规划NOIP提高组2010 描述 在一个遥远的国度,一侧是风景秀美的湖泊,另一侧则是漫无边际的沙漠。该国的行政区划十分特殊,刚好构成一个N行M列的矩形,其中每个格子都代表一座城市,...
  • yuyanggo
  • yuyanggo
  • 2015-09-27 16:50
  • 623
    个人资料
    • 访问:509682次
    • 积分:11352
    • 等级:
    • 排名:第1599名
    • 原创:639篇
    • 转载:5篇
    • 译文:0篇
    • 评论:93条
    博客专栏