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 #243 (Div. 1)A. Sereja and Swaps 暴力
A. Sereja and Swaps time limit per test 1 second memory limit per test 256 megabytes input standard ...
- 详解Object.constructor
对象的constructor属性引用了该对象的构造函数.对于 Object 对象,该指针指向原始的 Object() 函数.如下: var obj = {}; obj.constructor //ƒ ...
- .NET程序员提高效率的70多个开发工具
工欲善其事,必先利其器,没有好的工具,怎么能高效的开发出高质量的代码呢?本文为各ASP.NET 开发者介绍一些高效实用的工具,涉及SQL 管理,VS插件,内存管理,诊断工具等,涉及开发过程的各个环节, ...
- DOM事件绑定方式
普通事件可以直接绑定 比如document.onmouseover=fn; 或者document.addEventListener("mouseover",fn,flase); a ...
- ZOJ 2112 Dynamic Rankings (动态第k大,树状数组套主席树)
Dynamic Rankings Time Limit: 10 Seconds Memory Limit: 32768 KB The Company Dynamic Rankings has ...
- 介绍一下开源项目FastAnimationWithPOP
介绍一下开源项目FastAnimationWithPOP JUL 23RD, 2014 这是一个非常easy的动画框架,基于Facebook的POP库. 使用它你就能够在故事版中以0行代码的代价来加入 ...
- IntelliJ IDEA使用教程三 SVN的集成与使用
注意: 虽然IDEA已经集成了svn客户端,但还是习惯使用第三方svn客户端,比如: TortoiseSVN. 就是因为使用的是第三方客户端,所以和IDEA集成的时候就出现了一个特别大的坑,因为svn ...
- 吐槽Windows 8,就没见过这么烂的平板操作系统
本文带有严重个人情感色彩,反感者慎入. CSDN 博文大赛得了个奖品,联想的平板电脑, MIIX2 8 .系统是 Windows 8 . 今天媳妇再次使用它,惹得我再次吐槽. 一句话.Windows ...
- JSPGen4 自学路线图
- 用最简单的例子理解模板方法模式(Template Method Pattern)
假设要做一道红烧肉,做法有很多,在不同的做法中都有相同的部分,比如都要放油.放肉.放调料等.也有不同之处,比如有些做法放可乐,有些做法放甜蜜酱,等等. 先提炼出一个抽象类,该类不仅有制作红烧肉的各个步 ...