随笔分类 - 刷题
摘要:这道题其实难度不算大,关键是有点坑。。。 下面讲讲我做此题的一些心得: 测试点2是白给,如果测试点2都过不了就完全是程序逻辑的问题。 测试点0和3 对应的是输出空格的问题,即当每行的字符输出完以后,无需再在其右侧输出空格。 测试点1 对应的是当所给数字恰好能构成一个沙漏时,也需输出0 (题目给的例子
阅读全文
摘要:#include<iostream> #include<stdio.h> using namespace std; int main() { int input,search; scanf("%d",&input); int *score = new int[input]; for(int i=0;
阅读全文
摘要:#第一种做法(21分) #include <iostream> #include<stdio.h> #include<iomanip> int main() { int input,need; //input代表月饼种类 ,need代表市场需要吨数 scanf("%d %d",&input,&nee
阅读全文
摘要:#此题可以只查找对的选项输出即可,没必要循环。 代码如下: #include<iostream> #include<stdio.h> using namespace std; int main() { string s; while (cin >> s) if(s.size() == 3 && s[
阅读全文
摘要:/** 划拳 题目关于数字的定义反了 PAT 1046 */ #include <iostream> using namespace std; int cal(int a,int b,int c,int d) { if(a+c==b&&a+c!=d) return 1; //甲赢输出1 if(a+c
阅读全文
摘要:/** PAT 1047 #非常重要的知识点: 用scanf("%d-%d %d")的方法来读取这类信息从而可提取出数字 #掌握printf,scanf的输入输出方法 #include<stdio.h> #include<iostream> using namespace std; int main
阅读全文

浙公网安备 33010602011771号