信息学奥赛一本通---第一章---C++语言入门--- 1000-1005 题解

121 阅读1分钟

注:此为c++代码

    虽然我的代码无注释,但如想复制,必须完全搞懂代码所对应的题!

Dev c++这东西点进来的都有吧,详情见我的另一篇文章。

正式进入题解部分:          (本人小白,大佬们请勿吐槽)

1000:

#include<bits/stdc++.h>
using namespace std;
int n,m;
int main()
{ 
	cin>>n>>m;
	cout<<n+m;
    return 0;
}

1001:

#include<bits/stdc++.h> 
using namespace std; 
int main() 
{ 
    cout<<"Hello,World!"<<endl;
    return 0; 
}

1002:

#include<bits/stdc++.h> 
using namespace std; 
int a,b,c; 
int main() 
{ 
    cin>>a>>b>>c; 
    cout<<b<<endl; 
    return 0; 
}

1003:

#include<bits/stdc++.h>
using namespace std;
int a,b,c;
int main()
{
	cin>>a>>b>>c;
	printf("%8d %8d %8d",a,b,c);
	return 0;
}

1004:

#include<bits/stdc++.h> 
using namespace std; 
char ch;
int main() 
{ 
    cin>>ch; 
    cout<<" "<<" "<<ch<<endl; 
    cout<<" "<<ch<<ch<<ch<<endl; 
    cout<<ch<<ch<<ch<<ch<<ch<<endl;
    return 0; 
}

1005:

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x,y,a,b;
    double z;
    cin>>x>>a>>y>>b;
    z=(y*b-x*a)/(b-a);
    cout<<fixed<<setprecision(2)<<z;
    return 0;
}

个人码风,不喜勿喷

唉,又发了一篇毫无技术含量的文章