PAT乙级
Noahの梦想
www.noah-dream.com
我的个人博客欢迎各位来访
展开
-
1024 科学计数法 (20 分)测试点2,3,4
测试点2,3,4卡的是E后面是+的情况 主要卡的是+的情况,题目不难,用substr截取出E前后的东西,然后根据情况输出即可,具体代码里有解释 #include<iostream> #include<string> #include<algorithm> #include<sstream> using namespace std; void ch...转载 2019-09-05 10:51:36 · 1485 阅读 · 1 评论 -
1023 组个最小数 (20 分)
注意,里给的不是每个数,0-9出现的次数 然后先进行排序,找到最小的不是0的数,然后输出这个数,剩下的按照顺出输出,以输出的这个数不输出 #include<iostream> #include<vector> #include<algorithm> using namespace std; int main() { int k; vecto...转载 2019-09-05 10:52:17 · 114 阅读 · 0 评论 -
1022 D进制的A+B (20 分)测试点3
测试点3卡的是,这个数a如果小于d的情况 #include<iostream> #include<vector> #include<algorithm> using namespace std; int main() { vector<int>ans; long long int a,b,d; cin>>a&...转载 2019-09-05 10:52:49 · 1044 阅读 · 0 评论 -
1021 个位数统计 (15 分)
这里用map做每个数和个数的映射 map<int,int>ans 如果每个数的个数不是0,那么这个数就是有效的数就输出就行了 #include<iostream> #include<map> #include<string> using namespace std; int main() { string k; cin>&...转载 2019-09-05 10:53:30 · 102 阅读 · 0 评论 -
1010 一元多项式求导 (25 分)
注意格式的控制就行了 #include<iostream> using namespace std; int main() { int a,b,flag=0; while(cin>>a>>b){ if(b){ if(flag==1){ cout<<" "; ...转载 2019-09-05 10:54:04 · 100 阅读 · 0 评论 -
1009 说反话 (20 分)
把每个字符用cin输入,因为cin是以空格为分割的,然后保存到ans里,然后倒叙输出 #include<iostream> #include<string> #include<algorithm> #include<vector> using namespace std; int main() { vector<string>...转载 2019-09-05 10:54:38 · 143 阅读 · 0 评论 -
1008 数组元素循环右移问题 (20 分)
先让m对n取余,然后先从n-m+1到n输出,然后在从0到n-m输出 #include<iostream> using namespace std; int main() { int n,m; int num[101010]; cin>>n>>m; for(int i=1;i<=n;i++){ cin&g...转载 2019-09-05 10:55:11 · 116 阅读 · 0 评论 -
1007 素数对猜想 (20 分)
先把所有的素数存进去,然后根据素数的差判断,最后输出 #include<iostream> #include<vector> #include<algorithm> #include<cmath> using namespace std; vector<int>num; int isprime(int n) { if(n==2...转载 2019-09-05 10:55:49 · 104 阅读 · 0 评论 -
1006 换个格式输出整数 (15 分)
根据字符串的长短,然后根据长短把每个字符放进去,然后根据每位来输出每个字符 #include<iostream> #include<string> #include<vector> #include<algorithm> using namespace std; int main() { string n; int bg=1; ...转载 2019-09-05 10:56:43 · 95 阅读 · 0 评论