终于也是会了这么经典的题目 解题思路:注意事项:偶数灯是开着,奇数灯是开着,其实不难啊,换个思路,一定要有思考的抽象的计算思维参考代码:n,m=map(int,input().split())l=[0foriinrange(n+1)]foriinrange(1,m+1):forjinrange(1, 题解列表 2023年05月05日 0 点赞 0 评论 645 浏览 评分:0.0
(c语言)详细解读 摘要:解题思路:数组对应编号取反注意事项:我自己想的,还有不少可以优化的,注释很详细的解释了我的代码参考代码:#include"stdio.h"void main(){ unsigned int h…… 题解列表 2023年01月02日 0 点赞 0 评论 594 浏览 评分:0.0
绕了好久,用数组方便,还是离不开for,累了哈哈 摘要:解题思路:建议用flag语句做判断,数组1、0开关注意事项:参考代码:#include<stdio.h>#define maxSize 50001int main(){ int arr[maxSize…… 题解列表 2023年01月19日 0 点赞 0 评论 658 浏览 评分:0.0
2821: 开关灯 摘要:解题思路:注意事项:参考代码:n,m=map(int,input().split())l=[1]*nfor i in range(1,m+1): for j in range(1,n+1): …… 题解列表 2023年02月13日 0 点赞 0 评论 686 浏览 评分:0.0
开关灯的详细解答 摘要:#include<stdio.h>int main(){ int m,n,i,j; scanf("%d %d",&n,&m); //输出顺序不能错 int a[n+1]; /*第一个人的行为*/ f…… 题解列表 2023年02月14日 0 点赞 0 评论 560 浏览 评分:0.0
2821: 开关灯 摘要:参考代码:#include<stdio.h> #include<math.h> int main() { int n,m; scanf("%d %d",&n,&m); …… 题解列表 2023年02月28日 0 点赞 0 评论 567 浏览 评分:0.0
2821: 开关灯 摘要:解题思路:注意事项:参考代码:N,M = map(int,input().split()) lights = [1] * N # 初始化列表 1为开,-1为关 closed = [] fo…… 题解列表 2023年03月04日 0 点赞 0 评论 599 浏览 评分:0.0
开关灯 C简单易懂 ####解题思路:用数组模拟开关灯####参考代码```cpp#include#include#definemaxn5010inta[maxn];intmain(){intn,k,first=1;inti,j;memset(a,0,sizeof(a));scanf("%d%d", 题解列表 2023年04月07日 0 点赞 0 评论 715 浏览 评分:0.0
判断逗号的输出个数 摘要:解题思路:注意事项:参考代码:#include <stdio.h>#include<string.h>int main(){ int N, M,count=0; int a[5000]; …… 题解列表 2023年04月19日 0 点赞 0 评论 476 浏览 评分:0.0
普通的写法 摘要:```cpp #include using namespace std; int a[5001],n,i,j,m; int main() { cin>>n>>m; boo…… 题解列表 2023年05月01日 0 点赞 0 评论 578 浏览 评分:0.0