s,min,i,k,n,r:longint;
begin
s:=0;min:=80;
read(n,r);
for i:=1 to n do
begin
readln(a[i]);
s:=s+a[i];
if a[i]<min then min:=a[i];
end;
for i:=n downto 1 do
begin
if (s mod i=0)and(i<min) then begin
k:=s div i;
writeln(k-n,’ ’,i);
if i>r then write(’T’) else write(’F’);
break;
end;
end;
end.
把
[color=red]i:=n downto 1 do[/color]
改成
[color=blue]i:=min downto 1 do[/color]
即可
#include<iostream>
#include<climits>
using namespace std;
int main(void){
int s=0,min=INT_MAX,temp;
int n,hope;
cin>>n>>hope;
for (int i=1;i<=n;i++){
cin>>temp;
s+=temp;
if (temp<min)min=temp;
}
for (int i=min;i>0;i--)//As least as possible
if (s%i==0){
int divide=s/i;
cout<<divide-n<<’ ’<<i<<endl;
if (i>hope) cout<<’T’;
else cout<<’F’;
break;
}
return 0;
}
var
s:array[0..20000]of integer;
n,r,x,i,m,p,sc,t,min,j:integer;
begin
readln(n,r);
min:=maxint;
for i:=1 to n do
begin
readln(s[i]);
p:=p+s[i];
if s[i]<min then min:=s[i];
end;
for i:=min downto 1 do
if p mod i=0 then begin j:=i;break;end;
sc:=p div j;
m:=sc-n;
writeln(m,’ ’,j);
if j>r then writeln(’T’)
else writeln(’F’);
end.
第5个点MS有问题
题目输入 r=10
结果 k=5
还输出‘T’?
难道10=5 [color=pink] —。—[/color]