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 自带图标库 android.R.drawable
在xml文件中调用. android:title="@string/secure_connect"android:orderInCategory="100"an ...
- goldengate复制过程字符集处理一例
源端是oracle, al32utf8,表里有乱码,目标端是sybase cp936,两端的DB都不能改字符集,而且源端是目标端的超集,当复制有乱码的数据(非中文或英文数字等),目标端replicat ...
- 实现viewpager下的圆点滑动
在Drawable目录下创建资源文件 使用shape标签画出背景圆点与当前圆点 背景圆点: <?xml version="1.0" encoding="utf-8& ...
- ACM - 动态规划专题 题目整理
CodeForces 429B Working out 预处理出从四个顶点到某个位置的最大权值,再枚举相遇点,相遇的时候只有两种情况,取最优解即可. #include<iostream> ...
- hdu 2081
PS:...找到好多水题.... #include "stdio.h" int main(){ ]; int i,j,n,N; scanf("%d",& ...
- 团队开发——冲刺1.a
冲刺阶段一(第一天) 1.今天准备做什么? 在了解C#的基础上,深入熟悉Windows窗体应用程序,熟练掌握基本功能. 2.明天做什么:简单设计界面.
- Win8远程[你的凭据不工作]的解决办法
用户名前加你的计算机名称就可以了....win8也会有这样的问题,有点匪夷所思了......
- C# delegate & event
public delegate void MyDelegate(string mydelegate);//声明一个delegate对象 //实现有相同参数和返回值的函数 public v ...
- PHP Forms
<html><body><form action="welcome.php" method="post">Name: < ...
- UI基础:UICollectionView
UITableView 和 UICollectionView的设计思路: 1.UITableView 的布局由TableView和UItableViewDelegate完成. 2.UICollecti ...