洛谷P5706~5710题解

P5706

#include<bits/stdc++.h>
using namespace std;
int main()
{
	double a,b;
	cin>>a>>b;
	printf("%3.3f",a/b);
	cout<<endl<<b*2;
	return 0;
}

P5707

#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll s,v,a,b,n,t;
int main()
{
    cin>>s>>v;
    n=(8+24)*60;
    t=ceil(s*1.0/v)+10;
    n-=t;
    if(n>=24*60) n-=24*60;
    b=n%60,a=n/60;
    if(a<10)
        if(b<10) printf("0%lld:0%lld",a,b);
        else printf("0%lld:%lld",a,b);
    else
        if(b<10) printf("%lld:0%lld",a,b);
        else printf("%lld:%lld",a,b);
    return 0;
}

P5708

#include<bits/stdc++.h>
using namespace std;
int main()
{
	double w,m,p,a[3]={0};
	cin>>a[0]>>a[1]>>a[2];
	p=(a[0]+a[1]+a[2])/2;
	w=p*(p-a[0])*(p-a[1])*(p-a[2]);
	m=sqrt(w);
	printf("%2.1f",m);
	return 0;
}

P5709

#include<iostream>
using namespace std;
int main()
{
	long long m,t,s;
	cin>>m>>t>>s;
	if(t==0)
	{
		cout<<0;
		return 0;
	}
	if(s==0)
	{
		cout<<m;
		return 0;
	}
	if(m-(s/t)>0&&s%t!=0)cout<<m-(s/t)-1;
	if(m-(s/t)>0&&s%t==0)cout<<m-(s/t);
	if(m-(s/t)<=0)cout<<0;
	//if(m-(s/t)<=0&&s%t==0)cout<<0;
	return 0;
}

P5710

#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long a;
	cin>>a;
	if((a>4&&a<=12)&&(a%2==0))cout<<1<<" ";
	else cout<<0<<" ";
	if((a>4||a<=12)||(a%2==0)||((a>4||a<=12)&&(a%2==0)))cout<<1<<" ";
	else cout<<0<<" ";
	if(((a>4&&a<=12)&&(a%2!=0))||((a<=4&&a>12)&&(a%2==0)))cout<<1<<" ";
	else cout<<0<<" ";
	if((a<=4&&a>12)&&(a%2!=0))cout<<1;
	else cout<<0;
	return 0;
}

  • 6
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值