题目链接:http://abc069.contest.atcoder.jp/assignments

A - K-City


Time limit : 2sec / Memory limit : 256MB

Score : 100 points

Problem Statement

In K-city, there are n streets running east-west, and m streets running north-south. Each street running east-west and each street running north-south cross each other. We will call the smallest area that is surrounded by four streets a block. How many blocks there are in K-city?

Constraints

  • 2≤n,m≤100

Input

Input is given from Standard Input in the following format:

n m

Output

Print the number of blocks in K-city.


Sample Input 1

Copy
3 4

Sample Output 1

Copy
6

There are six blocks, as shown below:


Sample Input 2

Copy
2 2

Sample Output 2

Copy
1

There are one block, as shown below:

题解:水题
 #include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
using namespace std;
int main()
{
int n,m;
while(cin>>n>>m){
cout<<(n-)*(m-)<<endl;
}
return ;
}

B - i18n


Time limit : 2sec / Memory limit : 256MB

Score : 200 points

Problem Statement

The word internationalization is sometimes abbreviated to i18n. This comes from the fact that there are 18 letters between the first i and the last n.

You are given a string s of length at least 3 consisting of lowercase English letters. Abbreviate s in the same way.

Constraints

  • 3≤|s|≤100 (|s| denotes the length of s.)
  • s consists of lowercase English letters.

Input

Input is given from Standard Input in the following format:

s

Output

Print the abbreviation of s.


Sample Input 1

Copy
internationalization

Sample Output 1

Copy
i18n

Sample Input 2

Copy
smiles

Sample Output 2

Copy
s4s

Sample Input 3

Copy
xyz

Sample Output 3

Copy
x1z

题解:水题

 #include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
using namespace std;
int main()
{
string a;
while(cin>>a){
int len=a.length();
cout<<a[]<<len-<<a[len-]<<endl;
}
return ;
}

C - 4-adjacent


Time limit : 2sec / Memory limit : 256MB

Score : 400 points

Problem Statement

We have a sequence of length Na=(a1,a2,…,aN). Each ai is a positive integer.

Snuke's objective is to permute the element in a so that the following condition is satisfied:

  • For each 1≤iN−1, the product of ai and ai+1 is a multiple of 4.

Determine whether Snuke can achieve his objective.

Constraints

  • 2≤N≤105
  • ai is an integer.
  • 1≤ai≤109

Input

Input is given from Standard Input in the following format:

N
a1 a2 aN

Output

If Snuke can achieve his objective, print Yes; otherwise, print No.


Sample Input 1

Copy
3
1 10 100

Sample Output 1

Copy
Yes

One solution is (1,100,10).


Sample Input 2

Copy
4
1 2 3 4

Sample Output 2

Copy
No

It is impossible to permute a so that the condition is satisfied.


Sample Input 3

Copy
3
1 4 1

Sample Output 3

Copy
Yes

The condition is already satisfied initially.


Sample Input 4

Copy
2
1 1

Sample Output 4

Copy
No

Sample Input 5

Copy
6
2 7 1 8 2 8

Sample Output 5

Copy
Yes

题解:找出4和2的倍数即可

 #include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
using namespace std;
const int N=;
int a[N];
int main()
{
int n;
cin>>n;
int t1=,t2=;
for(int i=;i<n;i++){
cin>>a[i];
if(a[i]%==)
t1++;
else if(a[i]%==)
t2++;
}
int flag=;
int m;
if(t2%==) m=t2;
else m=t2-;
if((n-m)/<=t1)flag=;
if(flag) cout<<"Yes"<<endl;
else cout<<"No"<<endl;
return ;
}

D - Grid Coloring


Time limit : 2sec / Memory limit : 256MB

Score : 400 points

Problem Statement

We have a grid with H rows and W columns of squares. Snuke is painting these squares in colors 12N. Here, the following conditions should be satisfied:

  • For each i (1≤iN), there are exactly ai squares painted in Color i. Here, a1+a2+…+aN=HW.
  • For each i (1≤iN), the squares painted in Color i are 4-connected. That is, every square painted in Color i can be reached from every square painted in Color iby repeatedly traveling to a horizontally or vertically adjacent square painted in Color i.

Find a way to paint the squares so that the conditions are satisfied. It can be shown that a solution always exists.

Constraints

  • 1≤H,W≤100
  • 1≤NHW
  • ai≥1
  • a1+a2+…+aN=HW

Input

Input is given from Standard Input in the following format:

H W
N
a1 a2 aN

Output

Print one way to paint the squares that satisfies the conditions. Output in the following format:

c11  c1W
:
cH1 cHW

Here, cij is the color of the square at the i-th row from the top and j-th column from the left.


Sample Input 1

Copy
2 2
3
2 1 1

Sample Output 1

Copy
1 1
2 3

Below is an example of an invalid solution:

1 2
3 1

This is because the squares painted in Color 1 are not 4-connected.


Sample Input 2

Copy
3 5
5
1 2 3 4 5

Sample Output 2

Copy
1 4 4 4 3
2 5 4 5 3
2 5 5 5 3

Sample Input 3

Copy
1 1
1
1

Sample Output 3

Copy
1

题解:看半天不懂撒意思 题解说是蛇形填数

 #include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
using namespace std;
int r,c,n,x,y,ans[][];
int main(void)
{
scanf("%d%d%d",&r,&c,&n);
x=,y=;
for(int i=,cnt;i<=n;i++){
scanf("%d",&cnt);
while(cnt--){
ans[x][y]=i;
if(y==c&&x%==)
y=c,x++;
else if(y==&&x%==)
y=,x++;
else if(x&)
y++;
else
y--;
}
}
for(int i=;i<=r;i++)
for(int j=;j<=c;j++)
printf("%d%c",ans[i][j],j==c?'\n':' ');
return ;
}

AtCoder Beginner Contest 069 ABCD题的更多相关文章

  1. AtCoder Beginner Contest 068 ABCD题

    A - ABCxxx Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement This contes ...

  2. AtCoder Beginner Contest 053 ABCD题

    A - ABC/ARC Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement Smeke has ...

  3. AtCoder Beginner Contest 070 ABCD题

    题目链接:http://abc070.contest.atcoder.jp/assignments A - Palindromic Number Time limit : 2sec / Memory ...

  4. AtCoder Beginner Contest 057 ABCD题

    A - Remaining Time Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement Dol ...

  5. AtCoder Beginner Contest 051 ABCD题

    A - Haiku Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement As a New Yea ...

  6. AtCoder Beginner Contest 052 ABCD题

    A - Two Rectangles Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement The ...

  7. AtCoder Beginner Contest 054 ABCD题

    A - One Card Poker Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement Ali ...

  8. AtCoder Beginner Contest 058 ABCD题

    A - ι⊥l Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement Three poles st ...

  9. AtCoder Beginner Contest 050 ABC题

    A - Addition and Subtraction Easy Time limit : 2sec / Memory limit : 256MB Score : 100 points Proble ...

随机推荐

  1. “我的小程序”来了 新版微信v6.7.1下拉就能找到

    今天iOS版微信迎来v6.7.1正式版发布,本次升级主要是可以把常用的小程序添加到“我的小程序”.近期版本微信可以直接浏览订阅号的消息,扫一扫可拍照翻译整页中英文,浏览的文章支持缩小为浮窗.两大更新如 ...

  2. 多线程之共享变量.md

    共享变量 - 共享变量:当多个线程同时访问一个变量的时候,会产生共享变量的问题 - 案例11 - 解决变量:锁.信号灯: - 锁(Lock): - 是一个标志,表示一个线程在占用一些资源 - 使用方法 ...

  3. open '/dev/hwlog_switch' fail -1, 13. Permission denied

    https://blog.csdn.net/qq_36317441/article/details/79376522 将HBuilder开发的APP运行在华为手机上时,控制台显示 open '/dev ...

  4. 外部盒模型大小固定 内部有边框div设置浮动时 缩放窗口内部div溢出的解决办法

    原因分析: chorme和firefox浏览器下当缩放窗口大小时,边框的计算宽度变大造成内部div宽度的计算宽度变大,外部div放不下内部div而溢出. 解决办法: 给内部div设置 box-sizi ...

  5. sendmail 发送邮件 zabbix 自定义报警

    配合zabbix 触发脚本 达到自定义报警目的 #!/bin/bash # Created : 2015.12.08 # Updated : 2015.12.08 # Author : sanmuya ...

  6. 模块讲解----pickle模块(只在python用的序列化与反序列化)

    特点 1.只能在python中使用,只支持python的基本数据类型. 2.可以处理复杂的序列化语法.(例如自定义的类的方法,游戏的存档等) 3.序列化的时候,只是序列化了整个序列对象,而不是内存地址 ...

  7. npm下载指定版本的插件

    eg:下载boostrap版本为3.3.7 npm install --save-dev bootstrap@3.3.7 备注:--save则将依赖的组件添加到package.json文件下 --sa ...

  8. node代码打包为 exe文件---端口进程关闭demo

    最近用到 java,用tomcat起的服务,经常服务关了,对应的进程还在跑,导致再次启动服务失败,需要手动关闭进程. 使用 dos命令虽然只有两行,总是输,也很烦. netstat -ano | fi ...

  9. 移动端--touch事件与点透问题

    也来说说touch事件与点击穿透问题: http://blog.csdn.net/alex8046/article/details/52299785

  10. MySQL--7MySQL自定义函数

    在函数体的内部可以书写多个sql语句,写多个sql语句的话就称为复合结构