1 条题解
-
0
C++ :
#include<iostream> #include<cstring> using namespace std; int main(){ double n,m; int x; double a[]={0.0,1.0,1.5,2.0,2.5,3.0}; cin>>n>>m>>x; double ans=n; ans+=a[x]; int num=m/ans; m-=num*ans; if(m==0){ cout<<num<<endl; }else{ cout<<num+1<<endl; } return 0; }
Java :
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] s = br.readLine().split(" "); int n = Integer.parseInt(s[0]); int m = Integer.parseInt(s[1]); int x = Integer.parseInt(s[2]); double c = 0; if(x == 0) { c = n; }else if(x == 1) { c = n + 1; }else if(x == 2) { c = n + 1.5; }else if(x == 3) { c = n + 2; }else if(x == 4) { c = n + 2.5; }else if(x == 5) { c = n + 3; } if(m % c == 0) { System.out.println((int)(m / c)); }else { System.out.println((int)((m / c) + 1)); } } }
Python :
# coding=utf-8 n,m,x = map(int,input().split()) sp =[0,1,1.5,2,2.5,3] n += sp[x] if m / n == int(m / n): print(int(m / n)) else: print(int(m / n) + 1)
- 1
信息
- ID
- 1633
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 5
- 标签
- 递交数
- 40
- 已通过
- 16
- 上传者