测试点10000 19没过!哪位大佬看看
查看原帖
测试点10000 19没过!哪位大佬看看
1544166
Wc_king楼主2024/11/29 14:13

for(int i=1;i<=n;i++){ if(i%k==0){ count++; int arr[]=new int[count]; for(int j=count-1;j<count;j++){ arr[j]=i; sum+=arr[j]; } }else{ temp++; int arr1[]=new int[temp]; for(int j=temp-1;j<temp;j++){ arr1[j]=i; sum1+=arr1[j];

            }
        }
    }
    float average = (sum/(count*1.0f));
    float average1= (sum1/(temp*1.0f));
    float g= (float) (Math.floor(average*10)/10.0);
    float j= (float) (Math.floor(average1*10)/10.0);
    System.out.println(g+" "+j);
}
}
2024/11/29 14:13
加载中...