博主欢迎转载,但请给出本文链接,我尊重你,你尊重我,谢谢~
http://www.cnblogs.com/chenxiwenruo/p/6789775.html
特别不喜欢那些随便转载别人的原创文章又不给出链接的
所以不准偷偷复制博主的博客噢~~

水题,就是统计n个数的数位和有多少个不同的,并且输出即可。

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <cstring>
#include <queue>
using namespace std;
const int maxn =;
int vis[maxn];
int main()
{
int n;
char val[];
memset(vis,,sizeof(vis));
scanf("%d",&n);
int cnt=;
for(int i=;i<n;i++){
scanf("%s",val);
int len=strlen(val);
int sum=;
for(int i=;i<len;i++){
sum+=val[i]-'';
}
if(!vis[sum])
cnt++;
vis[sum]=;
}
printf("%d\n",cnt);
bool first=true;
for(int i=;i<;i++){
if(vis[i]){
if(first){
printf("%d",i);
first=false;
}
else
printf(" %d",i);
}
}
return ;
}

PAT甲题题解-1120. Friend Numbers (20)-水题的更多相关文章

  1. PAT甲题题解-1041. Be Unique (20)-水题

    博主欢迎转载,但请给出本文链接,我尊重你,你尊重我,谢谢~http://www.cnblogs.com/chenxiwenruo/p/6789189.html特别不喜欢那些随便转载别人的原创文章又不给 ...

  2. PAT甲题题解-1050. String Subtraction (20)-水题

    #include <iostream> #include <cstdio> #include <string.h> #include <algorithm&g ...

  3. PAT甲题题解-1032. Sharing (25)-链表水题

    #include <iostream> #include <cstdio> #include <algorithm> #include <string.h&g ...

  4. PAT (Advanced Level) Practice 1120 Friend Numbers (20 分) (set)

    Two integers are called "friend numbers" if they share the same sum of their digits, and t ...

  5. PAT甲题题解-1121. Damn Single (25)-水题

    博主欢迎转载,但请给出本文链接,我尊重你,你尊重我,谢谢~http://www.cnblogs.com/chenxiwenruo/p/6789787.html特别不喜欢那些随便转载别人的原创文章又不给 ...

  6. PAT甲级 1120. Friend Numbers (20)

    1120. Friend Numbers (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Two in ...

  7. PAT 甲级 1023 Have Fun with Numbers (20 分)(permutation是全排列题目没读懂)

    1023 Have Fun with Numbers (20 分)   Notice that the number 123456789 is a 9-digit number consisting ...

  8. [poj2247] Humble Numbers (DP水题)

    DP 水题 Description A number whose only prime factors are 2,3,5 or 7 is called a humble number. The se ...

  9. 【专业找水题】状压dp最水题,没有之一

    题目链接 现在代码能力没上升,倒是越来越会找水题了(比例题还水的裸题你值得拥有) 这网站不是针对竞赛的,所以时空限制都很宽松 然后就让我水过去了 对于每个点,包括自己的前m个元素是否取都是一种状态,所 ...

随机推荐

  1. beta冲刺————第一天(1/5)

    人员的再次分配: 调走人员:陈裕鹏(原来在本队伍主要进行文章推荐算法的设计) 调入人员:陈邡(原Dipper团队,负责游戏内容的策划案,以及做一些后端的探索工作.) 现队员工作划分: 王国华,吴君毅, ...

  2. Alpha冲刺报告(5/12)(麻瓜制造者)

    今日已完成 明日计划 部分api示意图 燃尽图 scrum会议照片 今日已完成 邓弘立: 完成部分首页逻辑功能 符天愉: 写代码写着写着想起来昨天的登录接口有个非常zz的逻辑错误,今天修改完后应该没有 ...

  3. JAVA内存管理 [转]

    首先我们要明白一点,我们所使用的变量就是一块一块的内存空间!!   一.内存管理原理:   在java中,有java程序.虚拟机.操作系统三个层次,其中java程序与虚拟机交互,而虚拟机与操作系统间交 ...

  4. 9.Solr4.10.3数据导入(post.jar方式和curl方式)

    转载请出自出处:http://www.cnblogs.com/hd3013779515/ 1.使用post.jar方式 java -Durl=http://192.168.137.168:8080/s ...

  5. splay专题复习——bzoj 3224 & 1862 & 1503 题解

    [前言]快要省选二试了.上次去被虐出翔了~~这次即便是打酱油.也要打出风採! 于是暂停新东西的学习,然后開始复习曾经的知识.为骗分做准备.PS:区间翻转的临时跳过,就算学了也来不及巩固了. [BZOJ ...

  6. ORA-27054错误处理

    版权声明:本文为博主原创文章,未经博主同意不得转载.个人技术站点:http://www.ezbit.ren https://blog.csdn.net/joeadai/article/details/ ...

  7. The Rock Game

    Before the cows head home for rest and recreation, Farmer John wantsthem to get some intellectual st ...

  8. Azkaban学习之路 (一)Azkaban的基础介绍

    一.为什么需要工作流调度器 1.一个完整的数据分析系统通常都是由大量任务单元组成: shell 脚本程序,java 程序,mapreduce 程序.hive 脚本等 2.各任务单元之间存在时间先后及前 ...

  9. Docker技术入门与实战 第二版-学习笔记-10-Docker Machine 项目-3-Command-line completion命令补全

    Command-line completion https://docs.docker.com/machine/completion/ Installing Command Completion——实 ...

  10. OC4J Configuration issue. /u01...dbhome_1/oc4j/j2ee/OC4J_DBConsole_orcl-db-01_orcl not found.

    emctl start dbconsole 报错信息: OC4J Configuration issue. /u01/app/Oracle/product/11.2.0/dbhome_1/oc4j/j ...