Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
acepta el reto 146
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
//gcc 5.4.0 // CRISTIAN IGNACIO TAPIA SALAS #include <stdio.h> #include <stdlib.h> #define MAX 100000 typedef struct posibleafortunado{ int n; char num[MAX]; }posibleafortunado; int main(void) { int i,j,cont1,cont2,cont3,flag; posibleafortunado a; do{ scanf("%d",&a.n); if(a.n==0)break; for(j=0;j<a.n;j++){ a.num[j]='0'; } cont1=2; cont2=a.n; while(cont1<=cont2){ flag=0; for(i=0;i<a.n && flag==0;i++){ if(a.num[i]=='0'){ j=i; flag=1; a.num[j]='1'; cont2--; } } cont3=0; while(j<a.n){ if(a.num[j]=='0'){ cont3++; } if(cont3==cont1){ a.num[j]='1'; cont3=0; cont2--; } j++; } cont1++; } printf("%d:",a.n); for(j=a.n-1;j>=0;j--){ if(a.num[j]=='0'){ printf(" %d",j+1); } } printf("\n"); }while(a.n!=0); return 0; }
gcc
3 10 30 0
Show compiler warnings
[
+
] Compiler args
[
-
]
Show input
Compilation time: 0.13 sec, absolute running time: 0.08 sec, cpu time: 0.02 sec, memory peak: 3 Mb, absolute service time: 0,3 sec
edit mode
|
history
|
discussion
3: 2 10: 10 6 4 30: 30 22 18 12 10