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. UVALive 4426 Blast the Enemy! 计算几何求重心

    D - Blast the Enemy! Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Subm ...

  2. C# 推送模板

    C#推送模板.安卓个推.消息推送 http://docs.getui.com/server/csharp/template/

  3. Oracle | 给表和字段添加注释

    comment  on  column  表名.字段名   is  '注释内容'; comment on column OPERATOR_INFO.MAIN_OPER_ID is '归属操作员'; c ...

  4. POJ 3580 SuperMemo (splay tree)

    SuperMemo Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 6841   Accepted: 2268 Case Ti ...

  5. 虚拟信用卡 全球付, 工商银行国际E卡, Bancore, Entropay, Payoneer

    虚拟信用卡 海外网购.购买国外域名空间.ebay等一些国外网站账号的激活这些情况都需要用到国际信用卡, 如果没有信用卡或者有信用卡但是对于安全性有所顾虑怎么办? 其实有一种东西叫做虚拟信用卡,正规银行 ...

  6. [MySql]锁表与解锁

    摘要 为啥会出现锁表的情况?锁表会导致数据表的其他操作超时,频繁的插入修改查询很容易出现锁表的情况.如果遇到这种情况,临时的解决办法,可以通过下面的方式进行解锁.如果长期有效的解决,那么就需要优化项目 ...

  7. 读 Zepto 源码系列

    虽然最近工作中没有怎么用 zepto ,但是据说 zepto 的源码比较简单,而且网上的资料也比较多,所以我就挑了 zepto 下手,希望能为以后阅读其他框架的源码打下基础吧. 源码版本 本文阅读的源 ...

  8. Arcgis Runtime for andriod 100 加载geodatabase

    private void LoadMY(){ try { String mainGeodatabaseFilePath = YLPub.getMapData() + "/gismap/sl. ...

  9. unity3d摄像机参数

    1. Clear Flags:清除标记.决定屏幕的哪部分将被清除.一般用户使用对台摄像机来描绘不同游戏对象的情况,有3中模式选择: Skybox:天空盒.默认模式.在屏幕中的空白部分将显示当前摄像机的 ...

  10. [翻译] FTCoreText

    FTCoreText An open source Objective-C interface component that makes use of the CoreText framework t ...