C++ 洛谷网站的题

2022/9/15 1:47:10

本文主要是介绍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;
}

  



这篇关于C++ 洛谷网站的题的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程