453 条题解
-
0libeining LV 5 @ 2019-08-19 15:21:16
这道题Chinaの各大OJ上都有~~吧~~
不解释,上代码:
#include <bits/stdc++.h> #define maxn 11 #define ri register int using namespace std; int read() { int r=0, f=1; char c=getchar(); while((c<'0'||c>'9')&&c!='-') c=getchar(); if(c=='-') f=-1,c=getchar(); while(c<='9'&&c>='0') r=r*10+c-'0',c=getchar(); return r*f; } int a[maxn], m, ans; int main() { for(ri i=1; i<maxn; i++) a[i]=read(); m=read(); for(ri i=1; i<maxn; i++) if(m+30>=a[i]) ans++; printf("%d", ans); return 0; }
-
02019-06-17 15:59:15@
#include <iostream>
using namespace std;
int main(void)
{
int apple[10];
int i=0,hand;
int num=0;
while(i<10){
cin>>apple[i];
++i;
}
cin>>hand;
hand+=30;
i=0;
while(i<10){
if(hand>=apple[i])++num;
++i;
}
cout<<num;
return 0;
} -
02019-02-11 21:54:22@
#include <iostream> using namespace std; int height[20],H,s; int main() { for(int i=0;i<10;i++)cin >> height[i]; cin >> H; H += 30; for(int i=0;i<10;i++)s+=!(H<height[i]); cout << s; }
-
02019-02-11 21:53:50@
#include <iostream> using namespace std; int height[20],H,s; int main() { for(int i=0;i<10;i++)cin >> height[i]; cin >> H; H += 30; for(int i=0;i<10;i++)s+=!(H<height[i]); cout << s; }
-
02019-02-11 21:53:50@
#include <iostream> using namespace std; int height[20],H,s; int main() { for(int i=0;i<10;i++)cin >> height[i]; cin >> H; H += 30; for(int i=0;i<10;i++)s+=!(H<height[i]); cout << s; }
-
02019-02-11 21:53:36@
#include <iostream> using namespace std; int height[20],H,s; int main() { for(int i=0;i<10;i++)cin >> height[i]; cin >> H; H += 30; for(int i=0;i<10;i++)s+=!(H<height[i]); cout << s; }
-
02018-11-10 09:48:32@
简单的一批
#include<bits/stdc++.h>
using namespace std;
int a[11];
int main(){
int n,count=0;
for(int i=1;i<=10;i++)scanf("%d",&a[i]);
scanf("%d",&n);n+=30;
for(int i=1;i<=10;i++)if(n>=a[i])count++;
printf("%d",count);
return 0;
} -
02018-11-04 17:34:13@
#include <iostream>
#include <queue>
using namespace std;
priority_queue<int>apple;
int main()
{
int i,tao,ap;
for(i=1;i<=10;i++)
{
cin>>ap;
apple.push(ap);
}
cin>>tao;
tao+=30;
for(i=1;i<=10;i++)
{
ap=apple.top();
if(tao>=ap)
break;
apple.pop();
}
cout<<11-i<<endl;
system("Pause");
return 0;
} -
02018-11-03 20:07:19@
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,ans=0,a[11];
for(int i=1;i<=10;i++) scanf("%d",&a[i]);
scanf("%d",&n);
for(int i=1;i<=10;i++)
if(n+30>=a[i]) ans++;
printf("%d",ans);
return 0;
} -
02018-10-23 11:00:29@
#include<iostream>
#include<cmath>
using namespace std;
int a[15];
int main()
{
int b,ans=0,k;
for(int i=1;i<=10;i++)
cin>>a[i];
cin>>b;
k=b+30;
for(int i=1;i<=10;i++)
{
if(a[i]<=k)
ans++;
}
cout<<ans<<endl;
return 0;
} -
02018-10-19 19:51:43@
#include<stdio.h>
int main(void)
{
int n = 0, max_len = 0;
int apple_len[10];for (int i = 0; i < 10; i++)
scanf("%d", &apple_len[i]);scanf("%d", &max_len);
for (int i = 0; i < 10; i++)
{
if (max_len >= apple_len[i] || max_len + 30 >= apple_len[i])
n++;
}
printf("%d", n);
return 0;
} -
02018-10-09 13:21:17@
#include<cstdio>
using namespace std;
int main()
{
int a[10],k,b=0;
for(int i=0;i<10;i++){
scanf("%d",&a[i]);
}
scanf("%d",&k);
for(int i=0;i<10;i++)
{
if(a[i]-30<=k){
b+=1;
}
}
printf("%d",b);
} -
02018-08-26 12:41:43@
var
a:array[1..10]of longint;
i,j,k,taotao:integer;
Begin
for i:= 1 to 10 do
begin
read(a[i]);
end;
readln(k);
j:=k+30;
i:=1;
for i:= 1 to 10 do
begin
if(a[i] <= j) then taotao:=taotao+1;
end;
writeln(taotao);
End.
求指点代码还可以简化吗? -
02018-08-18 17:44:19@
这是一道很简单的模拟题,一个循环即可。
#include<cstdio> #include<iostream> using namespace std; int a[11],ans,x; int main(){ for(int i=1;i<=10;i++){ cin>>a[i]; } cin>>x; x=x+30; for(int i=1;i<=10;i++){ if(a[i]<=x) ans++; } cout<<ans; return 0; }
-
02018-07-24 13:03:13@
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a[10];
int n,h,ans=0;
for(int i=1;i<=10;i++)
cin>>a[i];
cin>>n;
h=n+30;
for(int i=1;i<=10;i++)
if(h>=a[i])
ans++;
cout<<ans<<endl;
} -
02018-07-22 12:35:44@
C++标程:
#include <iostream>
using namespace std;
int a[15];
int main()
{
int n,count=0;//count为累加器
for (int i=1;i<=10;i++)
cin>>a[i];//输入10个苹果🍎离地面的高度
cin>>n;//陶陶伸手最大高度
n+=30;//在加上板凳的高度,求出陶陶摘苹果最高的高度
for (int i=1;i<=10;i++)
if (n>=a[i]) count++;//如果够得到,就加1
cout<<count<<endl;
return 0;
} -
02018-06-21 15:02:48@
height_of_apple = input(" ")
arm_height = input(" ")
arm_height = int(arm_height)
height_of_apple = height_of_apple.split()
e = list()
for c in height_of_apple:
c = int(c)
if arm_height >= c or arm_height + 30 >= c:
e.append(c)
print(len(e)) -
02018-06-21 15:02:30@
height_of_apple = input(" ")
arm_height = input(" ")
arm_height = int(arm_height)
height_of_apple = height_of_apple.split()
e = list()
for c in height_of_apple:
c = int(c)
if arm_height >= c or arm_height + 30 >= c:
e.append(c)
print(len(e)) -
02018-04-30 21:41:26@
using System;
using System.Linq;namespace ConsoleApplication6
{
class Program
{
static void Main(string[] args)
{
string str1 = Console.ReadLine();
string str2 = Console.ReadLine();
string[] strnumLlist = str1.Split(' ');Console.WriteLine((from s in strnumLlist
where int.Parse(s) <= int.Parse(str2) + 30
select int.Parse(s)).Count());
}
}
} -
02018-04-30 21:41:02@
using System;
using System.Linq;namespace ConsoleApplication6
{
class Program
{
static void Main(string[] args)
{
string str1 = Console.ReadLine();
string str2 = Console.ReadLine();
string[] strnumLlist = str1.Split(' ');Console.WriteLine((from s in strnumLlist
where int.Parse(s) <= int.Parse(str2) + 30
select int.Parse(s)).Count());
}
}
}