Codeforces Round #339 Div.2 B - Gena's Code
It's the year 4527 and the tanks game that we all know and love still exists. There also exists Great Gena's code, written in 2016. The problem this code solves is: given the number of tanks that go into the battle from each country, find their product. If it is turns to be too large, then the servers might have not enough time to assign tanks into teams and the whole game will collapse!
There are exactly n distinct countries in the world and the i-th country added ai tanks to the game. As the developers of the game are perfectionists, the number of tanks from each country is beautiful. A beautiful number, according to the developers, is such number that its decimal representation consists only of digits '1' and '0', moreover it contains at most one digit '1'. However, due to complaints from players, some number of tanks of one country was removed from the game, hence the number of tanks of this country may not remain beautiful.
Your task is to write the program that solves exactly the same problem in order to verify Gena's code correctness. Just in case.
The first line of the input contains the number of countries n (1 ≤ n ≤ 100 000). The second line contains n non-negative integers aiwithout leading zeroes — the number of tanks of the i-th country.
It is guaranteed that the second line contains at least n - 1 beautiful numbers and the total length of all these number's representations doesn't exceed 100 000.
Print a single number without leading zeroes — the product of the number of tanks presented by each country.
3
5 10 1
50
4
1 1 10 11
110
5
0 3 1 100 1
0 水题啦不过要注意一些细节 比如对0的处理 比如...好像没什么了啊...
#include <iostream>
#include <string>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <queue>
#include <map>
#include <vector>
#include <set>
#include <algorithm>
#define INF 0x3F3F3F3F
using namespace std; bool isBeautiful(char data[]){
int len = strlen(data);
if(data[] != '') return false;
for(int i = ; i < len; i++){
if(data[i] != '') return false;
}
return true;
} int main()
{
int n, digit = ;
char data[], nonb[] = "";
bool zero = false;
scanf("%d", &n);
while(n--){
scanf("%s", data);
if(data[] == '') zero = true;
if(isBeautiful(data)) digit += strlen(data) - ;
else strcpy(nonb, data);
}
if(zero) puts("");
else{
printf("%s", nonb);
for(int i = ; i <= digit; i++) printf("");
putchar('\n');
}
return ;
}
close
Codeforces Round #339 Div.2 B - Gena's Code的更多相关文章
- Codeforces Round #339 (Div. 2) B. Gena's Code 水题
B. Gena's Code 题目连接: http://www.codeforces.com/contest/614/problem/B Description It's the year 4527 ...
- Codeforces Round #339 (Div.2)
A. Link/Cut Tree time limit per test 2 seconds memory limit per test 256 megabytes input standard in ...
- Codeforces Round #339 (Div. 1) A. Peter and Snow Blower 计算几何
A. Peter and Snow Blower 题目连接: http://www.codeforces.com/contest/613/problem/A Description Peter got ...
- Codeforces Round #339 (Div. 2) A. Link/Cut Tree 水题
A. Link/Cut Tree 题目连接: http://www.codeforces.com/contest/614/problem/A Description Programmer Rostis ...
- Codeforces Round #339 (Div. 1) C. Necklace 构造题
C. Necklace 题目连接: http://www.codeforces.com/contest/613/problem/C Description Ivan wants to make a n ...
- Codeforces Round #339 (Div. 1) B. Skills 暴力 二分
B. Skills 题目连接: http://www.codeforces.com/contest/613/problem/B Description Lesha plays the recently ...
- Codeforces Round #339 Div.2 C - Peter and Snow Blower
Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. A ...
- Codeforces Round #339 Div.2 A - Link/Cut Tree
第一次正式参加常规赛想想有些小激动的呢 然后第一题就被hack了 心痛 _(:зゝ∠)_ tle点在于越界 因此结束循环条件从乘变为除 done //等等 这题没过总评 让我静静........ // ...
- Codeforces Round #339 (Div. 2) A
Description Programmer Rostislav got seriously interested in the Link/Cut Tree data structure, which ...
随机推荐
- Android安全之WebViewUXSS漏洞
Android安全 WebView UXSS app开发 漏洞分析 移动安全 0X01 前言 XSS是我们比较熟悉的一种攻击方式,包括存储型XSS.反射型XSS.DOM XSS等,但UXSS(通用型X ...
- hdu2476 区间dp
//Accepted 300 KB 31 ms //区间dp 思路完全网上看的 #include <cstdio> #include <cstring> #include &l ...
- PAT 06-1 简单计算器
想看一般简单计算器实现的看客不好意思了,这不是你想要点东西,此处题设为“只能进行加减乘除”.“都是整数”.”优先级相同“和"从左到右".此题来自PAT(http://www.pat ...
- 2016-1-9 Quartz框架的学习,写字板demo
一:自定义view .h文件中代码如下 #import <UIKit/UIKit.h> @interface ZLpaintView : UIView @property(nonatomi ...
- postgreSQL初步使用总结
一.安装 postgreSQL安装完成后会默认生成一个名为postgres的用户和一个名为postgres的数据库.可以使用自带的psql.exe工具来登录.其帮助信息如下 连接到本地的postgre ...
- 极客DIY:使用树莓派制作一架四轴无人机
如果你想DIY一台属于自己的无人机,那么接下来可以阅读这篇文章,阅读完毕之后也许对你会有启发. 这个项目主要用到的零件主要来自Erle Robotics(一个使用Linux系统的开源四轴飞行器项目). ...
- 浅谈Android应用性能之内存
本文来自http://blog.csdn.net/liuxian13183/ ,引用必须注明出处! 文/ jaunty [博主导读]在Android开发中,不免会遇到许多OOM现象,一方面可能是由于开 ...
- PHP CI分页类带多个参数
通过修改system中的pagination.php,给每个<a>都增加了class="pagination". view页面 <div class=" ...
- VS2010命令行编译C#和VC项目
VS2010命令行编译C#和VC项目 VS2010命令行编译C#和VC项目 根据需要动态创建数据库字段后,需要动态创建或者调整页面,那就需要编译这些页面和后台文件.因此使用命令行编译将会非常方便,对于 ...
- JS实现Tab选项卡
http://www.jb51.net/article/24694.htm http://www.sunsean.com/idTabs/#t1 http://www.cnblogs.com/sskse ...