这个为什么re,求大佬指点
查看原帖
这个为什么re,求大佬指点
281428
cakwhfkjdhslkgj楼主2020/5/7 17:12
#include<stdio.h>

int main()
{
	FILE* in = fopen("dnf.in", "r");
	FILE* out = fopen("dnf.out", "w");
	int MP=0, Count=0, HP=0;
	fscanf(in, "%d%d%d", &MP, &Count, &HP);
	int Mcost=0, damage=0;
	int flag = 1;
	for (int i = 0; i < Count; i++)
	{
		fscanf(in,"%d%d", &Mcost, &damage);
		if (Mcost == 0)
		{
			fprintf(out, "%d ", i + 1);
			flag = 0;
		}
		else if (MP / Mcost * damage >= HP)
		{
			fprintf(out, "%d ", i + 1);
			flag = 0;
		}
	}
	if (flag)
		fprintf(out, "-1");
	fclose(out);
	fclose(in);
	return 0;
}
2020/5/7 17:12
加载中...