Strange Addition
http://codeforces.com/problemset/problem/305/A
#include<iostream>
#include<cstdio>
#include<algorithm> using namespace std; int main()
{
int k,i,j,n,t,x,y,z,x1,y1,z1,p;
int d[110],a[110];
while(scanf("%d",&k)!=EOF)
{
for(i = 0; i < k; i++)
{
scanf("%d",&d[i]);
}
sort(d,d+k);
n = 1;
a[0] = d[0];
for(i = 1; i < k; i++)
{
t = d[i];
x = t%10; //个位
t = t/10;
y = t%10; //十位
t = t/10;
z = t; //百位
for(j = 0; j < n; j++)
{
p = a[j];
x1 = p%10; //个位
p = p/10;
y1 = p%10; //十位
p = p/10;
z1 = p; //百位
if((x==0||x1==0)&&(y==0||y1==0)&&(z==0||z1==0))
{
continue;
}
else
{
break;
}
}
if(j == n)
{
a[n++] = d[i];
}
}
printf("%d\n%d",n,a[0]);
for(j = 1; j < n; j++)
{
printf(" %d",a[j]);
}
printf("\n");
} return 0;
}
Strange Addition的更多相关文章
- CF 305A——Strange Addition——————【暴力加技巧】
A. Strange Addition time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- codeforces A. Strange Addition 解题报告
题目链接:http://codeforces.com/problemset/problem/305/A 题目意思:给出一个序列,需要从中选择一些数,这些数需要满足:任意的两个数中每一位至少有一个数满足 ...
- Solution -「CF 1380F」Strange Addition
\(\mathcal{Description}\) Link. 定义两个数在进行加法时,进位单独作为一位.例如: . 给定一个 \(n\) 为数和 \(m\) 次修改操作,每次修改会修改 ...
- codeforces305A
Strange Addition CodeForces - 305A Unfortunately, Vasya can only sum pairs of integers (a, b), such ...
- Codeforces Round #184 (Div. 2)
A. Strange Addition (目前的做法好像做烦了) 统计数的\(mask\),表示个.十.百位上是否是0,共8种数. 枚举8种数组成的所有情况\(2^8\),记录最大数量. B. Con ...
- [LeetCode] Range Addition 范围相加
Assume you have an array of length n initialized with all 0's and are given k update operations. Eac ...
- iOS 之 SVN提交错误:"XXX" is scheduled for addition, but is missing
今天使用SVN提交项目时,出现了这样的提示:"XXX" is scheduled for addition, but is missing.(无关紧要的东西用XXX代替). 看报错 ...
- timus 1175. Strange Sequence 解题报告
1.题目描述: 1175. Strange Sequence Time limit: 1.0 secondMemory limit: 2 MB You have been asked to disco ...
- CF719C. Efim and Strange Grade[DP]
C. Efim and Strange Grade time limit per test 1 second memory limit per test 256 megabytes input sta ...
随机推荐
- python开发_tkinter_单选菜单_不可用菜单操作
在之前的blog中有提到python的tkinter中的菜单操作 python开发_tkinter_窗口控件_自己制作的Python IDEL_博主推荐 python开发_tkinter_窗口控件_自 ...
- [转载] 使用Kettle进行数据迁移(ETL)
由于开发新的系统,需要将之前一个老的C/S应用的数据按照新的数据设计导入到新库中.此过程可能涉及到表结构不一致.大数据量(千万级,甚至上亿)等情况,包括异构数据的抽取.清洗等等工作.部分复杂的工作需要 ...
- addEventListener 的一些好方法 简单粗暴的说给你
function show(){ document.addEventListener("click",fn,{ "passive":false, "c ...
- A* search算法解迷宫
这是一个使用A* search算法解迷宫的问题,细节请看:http://www.laurentluce.com/posts/solving-mazes-using-python-simple-recu ...
- Zookeeper Monitor集群监控开发
随着线上越来越多的系统依赖Zookeeper集群.以至于Zookeeper集群的执行状况越来越重要.可是眼下还没有什么好用的Zookeeper集群监控系统(淘宝开源了一个Zookeeper监控系统,可 ...
- debuginfo-install glibc-2.17-157.el7.x86_64
Running transaction Installing : glibc-debuginfo-common-.el7.x86_64 / Installing : glibc-debuginfo-. ...
- ibatis实战之中的一个对多关联
在实际开发中,我们经常遇到关联数据的情况,如User对象拥有若干Book对象 每一个Book对象描写叙述了归属于一个User信息,这样的情况下,我们应该怎样处理? 通过单独的Statement操作固然 ...
- [java web 入门](一)MyEclipse & HelloWorld 记录
第一部,下载安装MyEclipse for mac. http://downloads.myeclipseide.com/downloads/products/eworkbench/2014/inst ...
- easyDarwin--开源流媒体实现
EasyDarwin 是由国内开源流媒体团队开发和维护的一款开源流媒体平台框架,从2012年12月创建并发展至今,从原有的单服务的流媒体服务器形式,扩展成现在的云平台架构的开源项目,更好地帮助广大流媒 ...
- poj 食物链
比基础的并查集有些进步. 在以下这个链接中有详解: http://blog.csdn.net/ditian1027/article/details/20804911 对于每两个动物的关系,都是先推与终 ...