编程语言
首页 > 编程语言> > C++ 洛谷网站的题

C++ 洛谷网站的题

作者:互联网

P1000

#include <iostream>
using namespace std;
int main(int argc, char** argv) {
	cout<<"                ********"<<endl
		<<"               ************"<<endl
		<<"               ####....#."<<endl
		<<"             #..###.....##...."<<endl
		<<"             ###.......######              ###            ###"<<endl
		<<"                ...........               #...#          #...#"<<endl
		<<"               ##*#######                 #.#.#          #.#.#"<<endl
		<<"            ####*******######             #.#.#          #.#.#"<<endl
		<<"           ...#***.****.*###....          #...#          #...#"<<endl
		<<"           ....**********##.....           ###            ###"<<endl
		<<"           ....****    *****...."<<endl
		<<"             ####        ####"<<endl
		<<"           ######        ######"<<endl
		<<"##############################################################"<<endl
		<<"#...#......#.##...#......#.##...#......#.##------------------#"<<endl
		<<"###########################################------------------#"<<endl
		<<"#..#....#....##..#....#....##..#....#....#####################"<<endl
		<<"##########################################    #----------#"<<endl
		<<"#.....#......##.....#......##.....#......#    #----------#"<<endl
		<<"##########################################    #----------#"<<endl
		<<"#.....#......##.....#......##.....#......#    #----------#"<<endl
		<<"##########################################    ############"<<endl;
	return 0;
}


P1001

#include <iostream>
using namespace std;
int main(int argc, char** argv) {
	int a,b;
	cin>>a>>b;
	cout<<a+b;
	return 0;
}


P1035

#include <iostream>
using namespace std;
int main(int argc, char** argv){
	int k,i;
	double s = 0;
	cin>>k;
	for(i = 1;s<=k;i++){
		s += 1.0/i;
	}
	cout<<i-1;		
}


P1046

#include <iostream>
using namespace std;
int main(int argc, char** argv){
	int a[9],d,b,s = 0;
	for(int i = 0;i<=9;i++){
		cin>>a[i];
	}
	cin>>b;
	for(int i = 0;i<=9;i++){
		if(b>=a[i]){
			s++;
		}else if(d+30+b>=a[i]){
			s++;
		}
	}
	cout<<s;		
}


1047

#include<iostream>
using namespace std;
int main(int argc, char** argv) {
	int L,M,a[10001],s[101],e[101];
	int ans=0;
	cin>>L>>M;
	for(int i=0;i<M;i++){
		cin>>s[i]>>e[i];
		for(int j = s[i];j<=e[i];j++){
			a[j]=1;
		}
	}
	for(int i=0;i<=L;i++){
		if(a[i]==0){
			ans++;
		}
	}
	cout<<ans;
	return 0;
}


P1059

#include<iostream>
using namespace std;
int main(int argc, char** argv) {
    int n,x;
    cin>>n;
    int sum(0),bus[1002] = {0};
    for(int i=1;i<=n;i++){
        cin>>x;
        if(bus[x]){
            continue;
        }
        bus[x]++;
        sum++;
    }
    cout<<sum<<endl;
    for(int i=1;i<=1000;i++){
        if(bus[i]){
            cout<<i<<' ';
        }
    }
    return 0;
}

  

标签:洛谷,网站,namespace,C++,char,int,argv,using,main
来源: https://www.cnblogs.com/wangyihang/p/16694721.html