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;
}

  

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/289530.html

(0)
上一篇 2022年9月15日
下一篇 2022年9月15日

相关推荐

发表回复

登录后才能评论