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 ...
随机推荐
- BZOJ 2750 HAOI 2012 Road 高速公路 最短路
题意: 给出一个有向图,求每条边有多少次作为最短路上的边(任意的起始点). 范围:n <= 1500, m <= 5005 分析: 一个比较容易想到的思路:以每个点作为起点,做一次SPFA ...
- Codeforces Round #350 (Div. 2) B. Game of Robots 水题
B. Game of Robots 题目连接: http://www.codeforces.com/contest/670/problem/B Description In late autumn e ...
- 你了解for循环吗
大家学什么语言都会学for循环 可是你真的会用吗 通常写法都是 var arr=arr[1,2,3,4]; for(var i=0;i<arr.length;i++){ console.log( ...
- 电感式DC/DC变换器工作原理
http://www.amobbs.com/thread-3293203-1-1.html 首先必须要了解电感的一些特性:电磁转换与磁储能.其它所有参数都是由这两个特性引出来的. 电感回路通电瞬间 断 ...
- MYSQL 源代码编绎脚本
http://blog.csdn.net/hopingwhite/article/details/5808101
- js自动补全实例
var oInputField ,oPopDiv , oColorsUl,aColors; //初始化变量 function initVars(modelId,divId,ulId){ oInputF ...
- founder面试题
.写出正面程序支行结果: #include<iostream> using namespace std; void func(int a) { static int c = a; c++; ...
- [leetcode]Binary Tree Preorder Traversal @ Python
原题地址:http://oj.leetcode.com/problems/binary-tree-preorder-traversal/ 题意:这题用递归比较简单.应该考察的是使用非递归实现二叉树的先 ...
- MSSQL工作中常用的小技巧
大概看了一下有接近二十天自己没有写博客了,一来是因为国庆之前公司工作总会比较繁杂一点,国庆自己也需要休息,二来是因为学习一些新的东西,公司写了一天SQL回家看了看以前的笔记,感觉还挺不错,贴出来供大家 ...
- 网上收集:跟着 8 张思维导图学习 Javascript【转】
学习的道路就是要不断的总结归纳,好记性不如烂笔头,so,下面将po出8张javascript相关的思维导图. 思维导图小tips:思维导图又叫心智图,是表达发射性思维的有效的图形思维工具 ,它简单却又 ...