为什么会编译失败,我在C++上都成功了?!

P5719 【深基4.例3】分类平均

SBGL @ 2024-08-11 20:14:42

#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<windows.h>
const int N=2;
int n,k,a[N],y,z=0;
double f,g;
int main(){
    std::cin>>n>>k;
    for(int i=1;i<=n;++i){
        if(i%k==0) {y++; f+=i;}
        if(i%k!=0) {z++; g+=i;}
    }
    printf("%.1lf %.1lf",f/y,g/z);
    return 0;
} 

by sbh2012 @ 2024-08-11 20:15:48

去掉#include<windows.h>


by liboya5074 @ 2024-08-11 20:17:32

洛谷的语言环境没有 windows.h


|