Created
October 4, 2021 23:08
-
-
Save PedroRacchetti/228de928262a349a30b2279e4a6b1131 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Comentário NOIC - OBI Fase 3 PJ - Ogro | |
// Complexidade: O(N) | |
// Escrito por Pedro Racchetti | |
#include<bits/stdc++.h> | |
using namespace std; | |
int n; | |
int maoesq, maodir; | |
int main(){ | |
scanf("%d", &n); | |
// Primeiro, calculamos o número de dedos | |
// mostrados por cada mão | |
if(n == 0){ | |
maodir = 0; | |
maoesq = 0; | |
}else if(n <= 5) maoesq = n, maodir = 0; | |
else maoesq = 5, maodir = n - 5; | |
// Agora, com auxílio do for, | |
// imprimimos a quantidade apropriada de dedos | |
if(maoesq == 0) printf("*\n"); | |
else { | |
for(int i = 1; i <= maoesq; i++) printf("I"); | |
printf("\n"); | |
} | |
if(maodir == 0) printf("*\n"); | |
else{ | |
for(int i = 1; i <= maodir; i++) printf("I"); | |
printf("\n"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment