【入门1】顺序结构 (今天刷洛谷了嘛)

【60天计划】

刷洛谷(题单广场) and Acwing算法基础课

P1001

A+B Problem 

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath> 
#include<vector>
using namespace std;
typedef long long  ll;
#define ios ios::sync_with_stdio(false);cin.tie(0), cout.tie(0)
const int N = 1e6;
int main()
{
	ll a,b;
	cin>>a>>b;
	cout<<a+b<<endl;
	 
 } 

P1000

超级玛丽游戏 

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath> 
#include<vector>
using namespace std;
typedef long long  ll;
#define ios ios::sync_with_stdio(false);cin.tie(0), cout.tie(0)
const int N = 1e6;
int main()
{
	ios;
	cout<< "                ********\n"
    "               ************\n"
    "               ####....#.\n"
    "             #..###.....##....\n"
    "             ###.......######              ###            ###\n"
    "                ...........               #...#          #...#\n"
    "               ##*#######                 #.#.#          #.#.#\n"
    "            ####*******######             #.#.#          #.#.#\n"
    "           ...#***.****.*###....          #...#          #...#\n"
    "           ....**********##.....           ###            ###\n"
    "           ....****    *****....\n"
    "             ####        ####\n"
    "           ######        ######\n"
    "##############################################################\n"
    "#...#......#.##...#......#.##...#......#.##------------------#\n"
    "###########################################------------------#\n"
    "#..#....#....##..#....#....##..#....#....#####################\n"
    "##########################################    #----------#\n"
    "#.....#......##.....#......##.....#......#    #----------#\n"
    "##########################################    #----------#\n"
    "#.#..#....#..##.#..#....#..##.#..#....#..#    #----------#\n"
    "##########################################    ############\n";
}

 

P5703

【深基2.例5】苹果采购 

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath> 
#include<vector>
using namespace std;
typedef long long  ll;
#define ios ios::sync_with_stdio(false);cin.tie(0), cout.tie(0)
const int N = 1e6;
int main()
{
	ios;
	ll a,b;
	cin>>a>>b;
	cout<<a*b<<"\n";
}

P5704

【深基2.例6】字母转换 

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath> 
#include<vector>
using namespace std;
typedef long long  ll;
#define ios ios::sync_with_stdio(false);cin.tie(0), cout.tie(0)
const int N = 1e6;
int main()
{
	ios;
	char ch;
	cin>>ch;
	if(ch>='a')
	cout<<char(ch-32);
	else
	cout<<char(ch+32);
	cout<<"\n"; 
}

P5705

【深基2.例7】数字反转 

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath> 
#include<vector>
using namespace std;
typedef long long  ll;
#define ios ios::sync_with_stdio(false);cin.tie(0), cout.tie(0)
const int N = 1e6;
char s[100];
int main()
{
	ios;
	cin>>s;
	reverse(s,s+strlen(s));
	cout<<s;
	cout<<'\n';
}

P5706

【深基2.例8】再分肥宅水 

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath> 
#include<vector>
using namespace std;
typedef long long  ll;
#define ios ios::sync_with_stdio(false);cin.tie(0), cout.tie(0)
const int N = 1e6;
int main()
{
	ios;
	double t;
	int n;
	cin>>t>>n;
	printf("%.3lf\n%d\n",t/n,n<<1);
}

P1425

小鱼的游泳时间 

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath> 
#include<vector>
using namespace std;
typedef long long  ll;
#define ios ios::sync_with_stdio(false);cin.tie(0), cout.tie(0)
const int N = 1e6;
int main()
{
	ios;
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	int begin = a*60+b;
	int end = c*60+d;
	int min = end-begin;
	cout<<min/60<<" "<<min%60<<"\n";
}

P2433(有点坑哦)

【深基1-2】小学数学 N 合一 

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath> 
#include<vector>
#include <iomanip>
using namespace std;
typedef long long  ll;
#define ios ios::sync_with_stdio(false);cin.tie(0), cout.tie(0)
const int N = 1e6;
int main()
{
	ios;
	int n;
	cin>>n;
	switch(n)
	{
		case 1:
			{
				cout<<"I love Luogu!\n";
				break;
			}
		case 2:
			{
				cout<<6<<' '<<4<<"\n";
				break;
			}
		case 3:
			{
				cout<<"3\n12\n2\n";
				break;
			}
		case 4:
			{
			cout<<fixed<<setprecision(3)<<1.0*500/3<<"\n";
				break;
			}
		case 5:
			{
				cout<<(260+220)/(12+20)<<"\n";
				break;
			}
		case 6:
			{
				cout<<sqrt(6*6+9*9)<<"\n";
				break;
			}
		case 7:
			{
				cout<<110<<"\n";
				cout<<90<<"\n";
				cout<<0<<"\n";
				break;
			}
		case 8:
			{
				const double pi = 3.141593;
				cout<<pi*10<<"\n"<<pi*25<<"\n"<<4/3.0*pi*125<<"\n";
				break;
			}
		case 9:
			{
				cout<<22<<"\n"; 
				break;
			}
		case 10:
			{
				// 8 -->30
				//10 -->6
				cout<<9<<"\n";
				break;
			}
		case 11:
			{
				cout<<100.0/3<<"\n";
				break;
			}
		case 12:
			{
				cout<<'M'-'A'+1<<"\n";
				cout<<char('A'+17)<<"\n";
				break; 
			}
		case 13:
			{
				const double pi = 3.141593;
				double v = 4.0/3*pi*(4*4*4+10*10*10);
				cout<<(int)pow(v,1.0/3)<<"\n";
				break;
			}
		case 14:
		{
			for(int i = 1;;i++)
			{
				if(i*(10+110-i)>3500)
				{
					cout<<i-1<<"\n";
					break;
				}
			}
		}
	};
}

P5708

【深基2.习2】三角形面积 

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath> 
#include<vector>
#include <iomanip>
using namespace std;
typedef long long  ll;
#define ios ios::sync_with_stdio(false);cin.tie(0), cout.tie(0)
const int N = 1e6;
int main()
{
	ios;
	double a,b,c;
	cin>>a>>b>>c;
	double p = (a+b+c)/2;
	printf("%.1lf\n",sqrt(p*(p-a)*(p-b)*(p-c)));
	
}

P1421

小玉买文具 

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath> 
#include<vector>
#include <iomanip>
using namespace std;
typedef long long  ll;
#define ios ios::sync_with_stdio(false);cin.tie(0), cout.tie(0)
const int N = 1e6;
int main()
{
	ios;
	int a,b;
	cin>>a>>b;
	double m = a+b/10.0;
	cout<<int(m/1.9)<<"\n";
}

 P5709

【深基2.习6】Apples Prologue / 苹果和虫子 (有坑哦)

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath> 
#include<vector>
#include <iomanip>
using namespace std;
typedef long long  ll;
#define ios ios::sync_with_stdio(false);cin.tie(0), cout.tie(0)
const int N = 1e6;
int main()
{
	ios;
	int m,t,s;
	cin>>m>>t>>s;
	if(t==0)
	{
		cout<<0<<"\n";
		return 0;
	}
	int q = m - (s+t-1)/t;
	cout<<(q>=0?q:0)<<endl;
}

P2181

对角线 (有坑哦)

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath> 
#include<vector>
#include <iomanip>
using namespace std;
typedef long long  ll;
#define ios ios::sync_with_stdio(false);cin.tie(0), cout.tie(0)
const int N = 1e6;
int main()
{
	ios;
	unsigned long long n;
	cin>>n;
	cout<<n*(n-1)/2*(n-2)/3*(n-3)/4<<"\n";
}

P5707

【深基2.例12】上学迟到 

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath> 
#include<vector>
#include <iomanip>
using namespace std;
typedef long long  ll;
#define ios ios::sync_with_stdio(false);cin.tie(0), cout.tie(0)
const int N = 1e6;
int main()
{
	ios;
	int s,v;
	cin>>s>>v;
	int t = (24+8)*60;
	int min = (s+v-1)/v+10;
	t-=min;
	if(t>=24*60)
	t-=24*60;
	int a = t/60;
	int b = t%60;
	if(a>9)
	cout<<a;
	else
	cout<<0<<a;
	cout<<':';
	if(b>9)
	cout<<b;
	else
	cout<<0<<b;
	cout<<"\n";
}

P3954

[NOIP2017 普及组] 成绩 

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath> 
#include<vector>
#include <iomanip>
using namespace std;
typedef long long  ll;
#define ios ios::sync_with_stdio(false);cin.tie(0), cout.tie(0)
const int N = 1e6;
int main()
{
	ios;
	double a,b,c;
	cin>>a>>b>>c;
	cout<<int(a*0.2+b*0.3+c*0.5)<<"\n";
}

 

2022/2/15本人发起60天洛谷挑战

想要加入挑战或代码交流,请私信作者(看到必回复!!!)

作者本人是一名大一小白(:

滑稽保命(:

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Joanh_Lan

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值