浙大 PAT b1039
来源:互联网 发布:淘宝网店赚钱吗 编辑:程序博客网 时间:2024/06/06 01:23
#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; }
0 0
- 浙大 PAT b1039
- PAT B1039
- PAT B1039. 到底买不买
- PAT乙级练习题B1039. 到底买不买
- 散列--PAT.B1039&A1092.到底买不买
- 浙大pat 1017
- 浙大pat Advance 1003
- 浙大PAT目录
- 浙大PAT 1049
- 浙大PAT 1051
- 浙大PAT 1058
- 浙大PAT 1063
- 浙大PAT 1102
- 浙大PAT 1099
- 浙大PAT 1033
- 浙大pat甲级 1023
- 浙大pat甲级 1024
- 浙大pat甲级 1025
- 浙大 PAT b1037
- UnityGUI系统之锚点与中心点
- Hurst Parameter Estimators
- Java EE知识结构
- 浙大 PAT b1038
- 浙大 PAT b1039
- 进程间通信之消息队列
- Java_io体系之BufferedWriter、BufferedReader简介
- lua的coroutine
- 浙大 PAT b1040
- Struts2配置时报struts-default.xml:65:72异常的解决方法
- Android Studio :如何导入Eclipse项目与AndroidStudio项目?
- 浙大 PAT a1001
- 第二十四期 OpenWrt ipk helloworld 《路由器就是开发板》