6 条题解

  • 1
    @ 2023-7-15 15:13:05
    #include<bits/stdc++.h>
    using namespace std;
    int main(){
    def upRange(start, stop, step):
    while start <= stop:
    yield start
    start += abs(step)
    def downRange(start, stop, step):
    while start >= stop:
    yield start
    start -= abs(step)
    
    for i in range(1, 6, 2):
    for j in (1 <= int(i)) and upRange(1, int(i), 1) or downRange(1, int(i), 1):
    print("*",end="");
    print(" ");
    return 0;
    }
    
    
    
    • 1
      @ 2023-3-16 19:27:07

      #include<bits/stdc++.h> using namespace std; int a[10000],head,tail,s; int main() { int n; cin>>n; for(int i=1;i<=n;i++) { a[tail]=i; tail++; } while(head<tail-1) { s++; if(s==3) { head++; s=0; }else { a[tail]=a[head]; tail++; head++; } } cout<<a[head]; return 0; }

      • 0
        @ 2023-3-4 11:21:28
        #include<iostream>
        #include<cstdio>
        using namespace std;
        int main() {
             int n,m=3,f= 0;
             cin>>n;
             for(int i = 1; i <= n; i++) f = (f + m) % i;
             cout << f + 1 << endl;
             return 0;
        }
        
        • -1
          @ 2023-3-16 19:25:28

          #include<bits/stdc++.h> using namespace std; int a[10000],he,lj,k; int main() { int n; cin>>n; for(int i=1;i<=n;i++) { a[lj]=i; lj++; } while(helj-1) { ++k; if(k3) { he++; k=0; } else { a[lj]=a[he]; lj++; he++; }

           }
          cout<<a[he];
           return 0;
          

          }

          • -2
            @ 2023-3-4 11:29:55

            #include<bits/stdc++.h> using namespace std; int a[101]; int main(){ int i=0,n,k=0,s=0; cin>>n; while(s<n-1){ i++; if(i==n+1){ i = 1; } if(a[i]0){ k++; } if(k3){ a[i]=1; k = 0; s++; } } for(int i=1;i<=n;i++){ if(a[i]==0){ cout<<i; } } return 0; }

            • -3
              @ 2023-3-16 19:28:36
              using namespace std;	
              int a[10001],tail,s,head;
              int main() {
              	int n;
              	cin>>n;
              	for(int i=1;i<=n;i++){
              		a[tail]=i;
              		tail++;
              	}
              	while(head<tail-1){
              		++s;
              		if(s==3){
              			head++;
              			s=0;
              		}
              		else{
              			a[tail]=a[head];
              			tail++;
              			head++;
              		}
              	}
              	cout<<a[head];
              	return 0;
              }
              
              • 1

              信息

              ID
              1276
              时间
              1000ms
              内存
              256MiB
              难度
              4
              标签
              递交数
              77
              已通过
              36
              上传者