GodSaveJava @ 2023-04-23 19:18:26
我的理解是: 10个人,10盏灯 1号全部关上,2号打开编号为2,4,6,8,10的灯,3号对编号3,9的灯做相反操作,4号对编号为4的灯做相反操作,5对5、6对6......那么8号灯不应该是关闭的吗?为什么答案里没有8号灯
by dk_qwq @ 2023-04-23 19:21:07
@GodSaveJava
1 0
2 1
4 0
8 1
by Elairin176 @ 2023-04-23 19:21:09
@GodSaveJava
by xiaofeng_and_xiaoyu @ 2023-04-23 20:07:02
@GodSaveJava 你后面可能理解错了,它是倍数变换,而不是平方数变换,像3,他应该还有6,4有8,5有10,变换应该是到
by GodSaveJava @ 2023-04-24 19:11:44
对倍数的理解有误,以为是该数的n次幂。我是伞兵,此贴完结
by zhangjiaye1 @ 2023-06-25 20:20:52
6
by soul2024 @ 2023-08-01 10:31:58
#include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
for(int i=1;i<=n;i++){if(i*i<=n){cout<<i*i<<" ";}}
return 0;
}