Skip to content

Instantly share code, notes, and snippets.

@so77id
Created July 3, 2021 19:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save so77id/d3d1c7c5e5f1870a6230015348eec8b7 to your computer and use it in GitHub Desktop.
Save so77id/d3d1c7c5e5f1870a6230015348eec8b7 to your computer and use it in GitHub Desktop.
EV3 Progrmacion 2021-1
#include<iostream>
#include<cmath>
using namespace std;
const int SIZE = 1000;
int main() {
int size;
int list[SIZE], s1[SIZE], s2[SIZE];
cin >> size;
for(int i = 0; i < SIZE; i++) {
cin >> list[i];
}
for(int i = 0; i < size; i++) {
int cright, cleft;
cright = cleft = 0;
for(int j = i + 1; j < size ; j++) {
cright++;
if(list[i] < list[j]) break;
}
for(int j = i-1; j >= 0; j--) {
cleft++;
if(list[i] < list[j]) break;
}
s1[i] = cright;
s2[i] = cleft;
}
for(int i=0; i<size; i++) {
cout << (i > 0 ? " " : "") << s1[i];
} cout << endl;
for(int i=0; i<size; i++) {
cout << (i > 0 ? " " : "") << s2[i];
} cout << endl;
return 0;
}
#include<iostream>
#include<cmath>
using namespace std;
const int SIZE = 10000;
int main() {
char word[SIZE];
char init;
bool ans = true;
cin >> word;
init = word[0];
while(cin >> word) {
if(word[0] != init) {
ans = false;
break;
}
}
if(ans) cout << "Verdadero" << endl;
else cout << "Falso" << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment