当前位置:   article > 正文

AtCoder Beginner Contest 195_health m death

health m death

A - Health M Death

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m;
	cin>>n>>m;
	if(m%n==0){
		cout<<"Yes"<<endl;
	}
	else {
		cout<<"No"<<endl;
	}
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

B - Many Oranges

确实不好意思说自己做这题做到绝望了=。=希望能把眼睛捐给会用的人嗷

#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,w,i,j;
	cin>>a>>b>>w;
	w*=1000;
	int max1=0,min1=1e9;
	for(i=1;i<=1000000;i++){
		if(a*i<=w&&b*i>=w){
			max1=max(max1,i);
			min1=min(min1,i);
		}
	}
	if(min1!=1e9&&max1!=0)
		cout<<min1<<" "<<max1<<endl;
	else 
		cout<<"UNSATISFIABLE"<<endl;
} 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19

C - Comma

明明很简单的数学题硬要开个啥dp数组磨了十多分钟
=。=

#include <bits/stdc++.h>
using namespace std;
#define int long long 
signed main()
{
	int n,ans=0;
	cin>>n;
	if(n>=1000)ans+=n-999;
	if(n>=1000000) ans+=n-999999;
	if(n>=1000000000) ans+=n-999999999;
	if(n>=1000000000000) ans+=n-999999999999;
	if(n>=1000000000000000) ans+=n-999999999999999;
	cout<<ans<<endl;
}


  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/74393
推荐阅读
相关标签
  

闽ICP备14008679号