B2002 Hello,World!
#include<iostream>
using namespace std;
int main()
{
printf("Hello,World!");
}
B2025 输出字符菱形
#include<bits/stdc++.h>
using namespace std;
int main(){
cout<<" *"<<endl;
cout<<" ***"<<endl;
cout<<"*****"<<endl;
cout<<" ***"<<endl;
cout<<" *"<<endl;
return 0;
}
P1000 超级玛丽游戏
#include<iostream>
using namespace std;
int main()
{
printf(" ********\n"
" ************\n"
" ####....#.\n"
" #..###.....##....\n"
" ###.......###### ### ###\n"
" ........... #...# #...#\n"
" ##*####### #.#.# #.#.#\n"
" ####*******###### #.#.# #.#.#\n"
" ...#***.****.*###.... #...# #...#\n"
" ....**********##..... ### ###\n"
" ....**** *****....\n"
" #### ####\n"
" ###### ######\n"
"##############################################################\n"
"#...#......#.##...#......#.##...#......#.##------------------#\n"
"###########################################------------------#\n"
"#..#....#....##..#....#....##..#....#....#####################\n"
"########################################## #----------#\n"
"#.....#......##.....#......##.....#......# #----------#\n"
"########################################## #----------#\n"
"#.#..#....#..##.#..#....#..##.#..#....#..# #----------#\n"
"########################################## ############\n"
);
}
P1001 A+B Problem
#include<iostream>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
cout<<a+b;
return 0;
}
P5703 【深基2.例5】苹果采购
#include<iostream>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
cout<<a*b;
return 0;
}
B2005 字符三角形
#include<iostream>
using namespace std;
int main()
{
char a;
cin>>a;
int b,c,d;
c=2;
d=1;
for(b=0;b<3;b++)
{
if(c>=0)
{
for(int e=c;e>0;e--)
printf(" ");
c--;
}
if(d<=5)
{
for(int e=d;e>0;e--)
cout<<a;
d=d+2;
}
cout<<endl;
}
}
P5704 【深基2.例6】字母转换
#include<iostream>
using namespace std;
int main()
{
char a;
cin>>a;
char b=a-32;
cout<<b;
}
P5705 【深基2.例7】数字反转
#include<bits/stdc++.h>
using namespace std;
int main()
{
string a;
cin>>a;
for(int len=a.size();len>0;len--)
{
cout<<a[len-1];
}
return 0;
}
P5706 【深基2.例8】再分肥宅水
#include<iostream>
using namespace std;
int main()
{
float a;
int b;
cin>>a>>b;
printf("%.3f\n%d",a/b,b*2);
return 0;
}
P5708 【深基2.习2】三角形面积
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
double a,b,c;
cin>>a>>b>>c;
double p=(a+b+c)/2.00;
double area=sqrt(p*(p-a)*(p-b)*(p-c));
printf("%.1lf",area);
return 0;
}
P5707 【深基2.例12】上学迟到
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
int s,v;
int h,m;
h=7;
m=50;
cin>>s>>v;
while(s>0)
{
s=s-v;
m--;
if(m<0)
{
h--;
m=59;
}
if(h<0)
{
h=23;
m=59;
}
}
printf("%02d:%02d",h,m);
return 0;
}
B2029 大象喝水
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a=3.14;
int b,c;
cin>>b>>c;
cout<<int(20000/(3.14*b*c*c))+1;
return 0;
}
P1425 小鱼的游泳时间
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c,d,e,f;
cin>>a>>b>>c>>d;
int count1=a*60+b;
int count2=c*60+d;
cout<<(count2-count1)/60<<' '<<(count2-count1)%60;
}
P1421 小玉买文具
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
int count1=a*10+b;
cout<<count1/19;
}
P3954 [NOIP2017 普及组] 成绩
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c;
cin>>a>>b>>c;
cout<<a*0.2+b*0.3+c*0.5;
}