浙大 PAT b1039
#include<stdio.h>
#include<string.h>
int main() { char s1[1001], s2[1001]; gets(s1); gets(s2); int len1 = strlen(s1), len2 = strlen(s2); //对每一个需要的珠子,寻找卖的链子,如果相同则“消掉”这一对。 for(int i = 0; i < len2; ++i) for(int j = 0; j < len1; ++j) if(s2[i] == s1[j]) { s2[i] = '*'; s1[j] = '*'; continue; } int n1 = 0, n2 = 0; for(int i = 0; i < len1; ++i) if(s1[i] != '*') ++n1; for(int i = 0; i < len2; ++i) if(s2[i] != '*') ++n2; if(n2) //如果需要的珠子没有全消掉,表示不能买 printf("No %d", n2); else printf("Yes %d", n1); return 0;
}
浙大 PAT b1039相关推荐
- 浙大pat | 浙大pat 牛客网PAT顶级(Top Level)练习题 1001
1001 LUCKY STRING 1872 8254 22% 题目描述 A string s is LUCKY if and only if the number of differentchara ...
- 浙大PAT甲级1040
浙大PAT甲级1040 原题 问题分析 原题 1040 Longest Symmetric String (25 分) Given a string, you are supposed to outp ...
- 浙大PAT甲级1019. General Palindromic Number (20)
1019. General Palindromic Number (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN ...
- 浙大 PAT b1040
#include <stdio.h> #include <string.h> int main() {char str[100001];gets(str);int numT = ...
- 浙大PAT 1003题 1003. Emergency
本题用Dfs搜索或者Dijkstra算法都可以,当然也有其它的方法.这题感觉是pat中常见的类型,非常重要. Dfs搜索代码: #include<stdio.h> int road[510 ...
- 浙大PAT甲级1027. Colors in Mars (20)
1027. Colors in Mars (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue People ...
- 浙大PAT甲级1006
1006. Sign In and Sign Out (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue ...
- 浙大PAT乙级1004. 成绩排名 (20)
1004. 成绩排名 (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 CHEN, Yue 读入n名学生的姓名.学号.成绩,分 ...
- 浙大 PAT 甲级1009
1009. Product of Polynomials (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yu ...
最新文章
- c嵌入python类获取返回值
- 小猫咪小狗狗也有智能「手表」了,可监测健康,识别情绪,还防乱跑|CES 2022...
- 开发一款自动指向特定页面元素的jQuery插件:jQuery PointPoint
- 这个没去大厂的程序猿,用 4 年时间证明自己做对了!
- N点虚拟主机管理系统安装图解
- Python最差实践
- OceanBase数据库开发和运维漫谈
- 禁止页面拖拽事件(数据什么的)
- darknet框架_【杂谈】面向新手的深度学习开源框架指导手册与GitHub项目,欢迎加入我们的开源团队...
- ROBOTSTXT_OBEY
- 哨兵系列卫星_国外卫星典型应用
- 在PPAPI插件中使用Skia绘图
- Adobe Flash Player不是最新版本的解决方法
- Office Professional Plus 2010 产品密钥
- netcfg.hlp 官方版
- springboot+uniapp上传图片
- 【pycharm】复制粘贴快捷键失效
- python代码实现进制转换
- 高效程序员的狂暴之路
- CRM系统,覆盖企业多应用场景