http://codeforces.com/problemset/problem/305/A


这题就是意思没看懂,一开始以为只要个位数只要一个为0就能相加,没想到到CF里面提交第三组就过不了,才发现是要各个位上面都要有一个为0的时候才能相加。
题意很重要。。。。
AC代码:
#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的更多相关文章

  1. CF 305A——Strange Addition——————【暴力加技巧】

    A. Strange Addition time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  2. codeforces A. Strange Addition 解题报告

    题目链接:http://codeforces.com/problemset/problem/305/A 题目意思:给出一个序列,需要从中选择一些数,这些数需要满足:任意的两个数中每一位至少有一个数满足 ...

  3. Solution -「CF 1380F」Strange Addition

    \(\mathcal{Description}\)   Link.   定义两个数在进行加法时,进位单独作为一位.例如: .   给定一个 \(n\) 为数和 \(m\) 次修改操作,每次修改会修改 ...

  4. codeforces305A

    Strange Addition CodeForces - 305A Unfortunately, Vasya can only sum pairs of integers (a, b), such ...

  5. Codeforces Round #184 (Div. 2)

    A. Strange Addition (目前的做法好像做烦了) 统计数的\(mask\),表示个.十.百位上是否是0,共8种数. 枚举8种数组成的所有情况\(2^8\),记录最大数量. B. Con ...

  6. [LeetCode] Range Addition 范围相加

    Assume you have an array of length n initialized with all 0's and are given k update operations. Eac ...

  7. iOS 之 SVN提交错误:"XXX" is scheduled for addition, but is missing

    今天使用SVN提交项目时,出现了这样的提示:"XXX" is scheduled for addition, but is missing.(无关紧要的东西用XXX代替). 看报错 ...

  8. timus 1175. Strange Sequence 解题报告

    1.题目描述: 1175. Strange Sequence Time limit: 1.0 secondMemory limit: 2 MB You have been asked to disco ...

  9. 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 ...

随机推荐

  1. PostgreSQL教程收集(中文文档/命令行工具/常用命令)

    http://www.postgres.cn/docs/9.6/index.html(中文文档) https://www.postgresql.org/docs/10/static/auth-meth ...

  2. SPOJ 10628. Count on a tree (树上第k大,LCA+主席树)

    10628. Count on a tree Problem code: COT You are given a tree with N nodes.The tree nodes are number ...

  3. android四大组件--ContentProvider具体解释

    一.相关ContentProvider概念解析: 1.ContentProvider简单介绍 在Android官方指出的Android的数据存储方式总共同拥有五种,各自是:Shared Prefere ...

  4. wrote a programming language

    https://medium.freecodecamp.org/the-programming-language-pipeline-91d3f449c919

  5. Android4.2.2启动动画前播放视频

    首先声明測试平台为瑞芯微的rk3168,Android4.2.2,Android版本号非常重要,由于Android4.0和Android4.2.2的代码有些地方就有差别,并不通用! 首先接到任务不知怎 ...

  6. IoC Containers with Xamarin

    When writing cross platform apps with Xamarin, our goal is share as close to 100% of our code across ...

  7. MVC批量添加,增加一条记录的同时添加N条集合属性所对应的个体

    类别中包含一个产品的集合属性,如何向数据库添加一条类别记录的同时,添加任意多个产品. public class Product { [DisplayName("产品名称")] pu ...

  8. C#编程(二)

    C#中的变量 例如:int i;//声明一个int类型的变量,变量名是 i;在未为该变量进行赋值操作前,禁止使用该变量.使用(=)给变量赋值,在声明之后可以 i=10来赋值.也可以在声明一个变量的同时 ...

  9. Android调用手机中的应用市场,去评分的功能实现

    在我们常常使用的软件当中,我们经常可以看到在软件的设置界面,有一个功能那就是去评分的功能,只要我们一点击“去评分”就会调用手机中的应用市场软件.一开始我以为这个功能的实现是要遍历整个手机中的软件包名, ...

  10. wrap ConcurrentDictionary in BlockingCollection

    ConcurrentDictionary<int, BlockingCollection<string>> mailBoxes = new ConcurrentDictiona ...