/ 科创班 /

记录详情

Accepted


  
# 状态 耗时 内存占用
#1 Accepted 3ms 632.0 KiB
#2 Accepted 2ms 628.0 KiB
#3 Accepted 2ms 608.0 KiB
#4 Accepted 2ms 588.0 KiB
#5 Accepted 2ms 636.0 KiB
#6 Accepted 3ms 640.0 KiB
#7 Accepted 4ms 640.0 KiB
#8 Accepted 5ms 636.0 KiB
#9 Accepted 3ms 584.0 KiB
#10 Accepted 5ms 516.0 KiB

代码

#include <iostream>
#include <string.h>
using namespace std;

const int Maxsize = 1000;

int main(void)
{
	int maps[Maxsize];
	memset(maps, 0, sizeof(maps));
	int num, people;
	cin >> num >> people;

	int i, j = 2;
	while (j <= people)
	{
		for (i = 0; i < num; i++)
		{
			if ((i + 1) % j == 0)
			{
				if (maps[i] == 0)
				{
					maps[i] = 1;
				}
				else if (maps[i] == 1)
				{
					maps[i] = 0;
				}
			}
		}
		j++;
	}

	for (i = 0; i < num; i++)
	{
		if (maps[i] == 0)
		{
			cout << i + 1 << " ";
		}
	}

	system("pause");
	return 0;
}

信息

递交者
类型
递交
题目
开灯问题
题目数据
下载
语言
C++
递交时间
2018-06-24 18:42:10
评测时间
2018-06-24 18:42:10
评测机
分数
100
总耗时
36ms
峰值内存
640.0 KiB