- 博客(18)
- 收藏
- 关注
原创 Java初学第一课
package hello; import java.util.Scanner; public class Hello { public static void main(String[] args) { // TODO Auto-generated method stub System.out.println("你好"); Scanner in = new Scanner(System.i...
2019-08-05 18:07:17 127
转载 STL set 简单的测试
#include #include #include using namespace std; int main() { set st; st.insert(string("abc")); st.insert(string("aba")); st.insert(string("abe")); st.insert(string("abf")); //aba在前边 st.erase(string(...
2019-04-11 20:19:11 115
转载 STL multimap 代码测试
#include #inlcude using namespace std; int main() { multimap<int,char> mmp; mmp.insert(pair<int, char>(1,‘a’)); mmp.insert(pair<int, char>(1,‘a’)); mmp.insert(pair<int, char>(1...
2019-04-09 21:07:10 128
转载 STL deque 简单的声明输出
#include #include using namespace std; int main() { deque de; de.push_front(12); deque<int>::iterator ite = de.begin(); for (ite; ite!= de.end(); ite++) { cout << *ite; } return 0; ...
2019-04-09 21:06:33 397
转载 STL map 代码测试
#include #include #include #include using namespace std; void fun (pair<int,char> pr) { cout << pr.first << " " << pr.second << endl; //first键值。second实值 } void MapConstr...
2019-04-09 21:05:38 108
转载 一些STL纠错
#inlcude #include #include #include using namespace std; int main() { string str(5,'a'); cout << str.capacity() << endl; str.resize(7); cout <<str.capacity() << endl; str.r...
2019-04-03 20:48:07 109
转载 STL list 代码测试
#include #include #include using namespace std; //typedef struct Node //{ // int a; // char c; //}*_Node; struct Node { int a; char c; Node(int d,char e) { a=d; c=e; //CoutAdd } bool oprrator== ...
2019-04-03 20:46:02 138
翻译 STL vector 代码测试
#include #include #include #include #include #include using namespace std; // vector,动态数组,自动分配空间, array,固定数组; void STLDefine() { struct STU { int age; } ; vector<string> vec; //相当于字符串数组 char...
2019-03-27 20:06:26 170
原创 STL string 代码测试
#include #include using namespace std; //定义 /*void Strdefine() { string str; cout << str << " " << str.empty() << endl; // 1 空的返回1,非空返回0 string str1(5,'a'); //5个a cout &l...
2019-03-21 20:18:12 80
原创 得分问题(UVa1585)
给出一个由O和X组成的串(长度为1~80),统计得分。每个O的得分为目前连续出现的O的个数,X的得分为0.例如OOXXOXXOOO的得分为1+2+0+0+1+0+0+1+2+3 #include<stdio.h> #include<string.h> int main() { char s[80]; int T; int i; int len; int sum=0; sca...
2018-10-29 19:42:47 197
原创 数数字
把前n(n<=1000)个整数顺次写在一起:123456798101112…数一数0~9各出现多少次(输出10个整数,分别是0,1,2,3,4,5,6,7,8,9出现的次数) ,#include<stdio.h> #include<string.h> int main() { char s[10000]; int a0=0,a1=0,a2=0,a3=0,a4=0,a5...
2018-10-23 20:17:20 232
转载 生成元问题
#include<stdio.h> #include<string.h> #define maxn=100005 int ans[maxn] { int main() int T,n; memset(ans,0,sizeof(ans)); for(int m=1;m<maxn;m++){ int x=m,y=m; while(x>0){y+=x%10;x/=10...
2018-10-16 20:11:04 282
转载 开灯问题
#include<stdio.h> #include<string.h> #define maxn 1010 int a[maxn]; int main() { int n,k,first=1; meset(a,0,sizeof(a)); scanf("%d%d",&n,&k);* for(int i=1;i<=k;i++) for(int j=1;j...
2018-10-16 19:14:25 111
原创 倒三角形问题
#include<stdio.h> int main() { int n,i,j; scanf("%d",&n); for(i=0;i<n;i++) { for(j=0;j<i;j++) printf(" “); for(;j<2*n-1-i;j++) printf(”#"); printf("\n"); } }
2018-10-09 20:49:22 297
翻译 会场安排问题
学校的小礼堂每天都会有许多活动,有时间这些活动的计划时间会发生冲突,需要选择出一些活动进行举办。小刘的工作就是安排学校小礼堂的活动,每个时间最多安排一个活动。现在小刘有一些活动计划的时间表,他想尽可能的安排更多的活动,请问他该如何安排。 输入 第一行是一个整型数m(m<100)表示共有m组测试数据。 每组测试数据的第一行是一个整数n(1<n<10000)表示该测试数据共有n个活动...
2018-09-27 17:44:30 94
翻译 c语言Fibonacci数
无穷数列1,1,2,3,5,8,13,21,34,55…称为Fibonacci数列,它可以递归地定义为 F(n)=1 …………(n=1或n=2) F(n)=F(n-1)+F(n-2)……(n>2) 现要你来求第n个斐波纳奇数。(第1个、第二个都为1) 输入 第一行是一个整数m(m<5)表示共有m组测试数据 每次测试数据只有一行,且只有一个整形数n(n<20) 输出 对每组输入n,...
2018-09-24 22:43:37 1661
原创 奇偶数分离
#include<stdio.h> int main(void) { int i,a,n; scanf("%d",&i); for(;i>=1;i–) { scanf("%d",n); printf(“1”); printf(" “); for(a=1;a<=n-2;) { a=a+2; printf(”%d “,a); } printf(”\n"); for(...
2018-09-18 19:50:36 410
翻译 ASCII码排序
输入三个字符(可以重复)后,按各字符的ASCII码从小到大的顺序输出这三个字符。 输入 第一行输入一个数N,表示有N组测试数据。后面的N行输入多组数据,每组输入数据都是占一行,有三个字符组成,之间无空格。 输出 对于每组输入数据,输出一行,字符中间用一个空格分开。 int main(void) { char a,b,c,d; int i; scanf(“%...
2018-09-18 19:48:35 190
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人