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 ...
随机推荐
- Codeforces Round #351 (VK Cup 2016 Round 3, Div. 2 Edition) D. Bear and Two Paths 构造
D. Bear and Two Paths 题目连接: http://www.codeforces.com/contest/673/problem/D Description Bearland has ...
- CF 277.5 C.Given Length and Sum of Digits.. 构造
#include <cstdio> #include <cmath> #include <cstring> #include <ctime> #incl ...
- 使用TensorFlow低级别的API进行编程
Tensorflow的低级API要使用张量(Tensor).图(Graph).会话(Session)等来进行编程.虽然从一定程度上来看使用低级的API非常的繁重,但是它能够帮助我们更好的理解Tenso ...
- SQLyog客户端无法连接MySQL服务器
环境:centos下使用yum 命令安装了mysql服务 1.进入linux 通过命令service mysqld start启动mysql的服务 2.使用sqlyog 连接mysql发现连接不上,如 ...
- ThinkPHP中RBAC权限管理的简单应用
RBAC英文全称(Role-Based Access Controller)即基于角色的权限访问控制,简单来讲,一个用户可以拥有若干角色,每一个角色拥有若干权限.这样,就构造成“用户-角色-权限”的授 ...
- SQL语句200条(转)
//重建数据库 101, create database testdatabase;use database testdatabase; 102, create table tt1(id int, n ...
- spring mvc 下 applicationContext 和webApplicationContext
spring中的ApplicationContexts可以被限制在不同的作用域.在web框架中,每个DispatcherServlet有它自己的WebApplicationContext,它包含了Di ...
- java编码问题总结
第一篇:JAVA字符编码系列一:Unicode,GBK,GB2312,UTF-8概念基础 第二篇:JAVA字符编码系列二:Unicode,ISO-8859,GBK,UTF-8编码及相互转换 第三篇:J ...
- mysql数据库字符集初步理解
1.MySQL(4.1以后版本) 服务器中有六个关键位置使用了字符集的概念,他们是: 1.client 2.connection 3.database 4.results 5.server 6.sys ...
- Java 8 中 HashMap 的性能提升
HashMap是一个高效通用的数据结构,它在每一个Java程序中都随处可见.先来介绍些基础知识.你可能也知 道,HashMap使用key的hashCode()和equals()方法来将值划分到不同的桶 ...