Бодолт илгээх | Бүх бодолтууд | Шилдэг бодолтууд | Жагсаалт руу буцах |
RGB7518 - Оргил ба ёроол |
Дараалан орсон 2 элемент бүр нь ялгаатай бүхэл тоон дараалал өгөгдөнө. Тоонууд нь өгсөж яваад уруудвал тэрхүү хэсгийг оргил, уруудаж яваад өгсвөл ёроол гэе. Тоон дараалал хэдэн оргил, хэдэн ёроол үүсгэснийг ол. Дарааллын хамгийн эхний болон сүүлийн тоо оргил болон ёроолд тоологдохгүй.
Input
Бүхэл тоон дараалал өгөгдөнө. Дарааллын урт 1000-аас ихгүй.
Output
Оргил болон ёроолын тоо зайгаар тусгаарлагдан нэг мөрөнд хэвлэгдэнэ.
Example
Input: 1 2 5 4 1 9 6 5 3 4 1 -2 Output: 3 2
Нэмсэн: | Bataa |
Огноо: | 2013-02-21 |
Хугацааны хязгаарлалт: | 1s |
Эх кодын хэмжээний хязгаарлалт: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Програмчлалын хэлүүд: | ADA95 ASM32 BASH BF C NCSHARP CSHARP C++ 4.3.2 CPP C99 CLPS LISP sbcl LISP clisp D ERL FORTRAN HASK ICON ICK JAVA JS-RHINO JULIA LUA NEM NICE OCAML PAS-GPC PAS-FPC PERL PHP PIKE PRLG-swi PYTHON PYPY3 PYTHON3 RUBY SCALA SCM guile ST TCL WHITESPACE |
hide comments
|
||||||
2024-12-04 06:31:17
aashi |
||||||
2024-10-09 12:26:05
#include <iostream> using namespace std; int main() { const int Boom = 1000; int shrek[Boom]; int n = 0; while (n < Boom&& cin >> shrek[n]) { n++; } int tegshee = 0; int tenuune = 0; for (int i = 1; i < n - 1; ++i) { if (shrek[i] > shrek[i - 1] && shrek[i] > shrek[i + 1]) { tegshee++; } else if (shrek[i] < shrek[i - 1] && shrek[i] < shrek[i + 1]) { tenuune++; } } cout << tegshee << " " << tenuune << endl; return 0; } |
||||||
2023-12-19 07:15:14
1. Don't post any source code here.| 2. Please be careful, leave short comments only. Don't spam here.| 3. For more discussion (hints, ideas, solutions) please visit our forum.| 4. Authors are allowed to delete the post and use html code here (e.g. to provide some useful links).||Notes:| 1. Don't post any source code here.| 2. Please be careful, leave short comments only. Don't spam here.| 3. For more discussion (hints, ideas, solutions) please visit our forum.| 4. Authors are allowed to delete the post and use html code here (e.g. to provide some useful links).||Notes:| 1. Don't post any source code here.| 2. Please be careful, leave short comments only. Don't spam here.| 3. For more discussion (hints, ideas, solutions) please visit our forum.| 4. Authors are allowed to delete the post and use html code here (e.g. to provide some useful links).||Notes:| 1. Don't post any source code here.| 2. Please be careful, leave short comments only. Don't spam here.| 3. For more discussion (hints, ideas, solutions) please visit our forum.| 4. Authors are allowed to delete the post and use html code here (e.g. to provide some useful links).||Notes:| 1. Don't post any source code here.| 2. Please be careful, leave short comments only. Don't spam here.| 3. For more discussion (hints, ideas, solutions) please visit our forum.| 4. Authors are allowed to delete the post and use html code here (e.g. to provide some useful links).||Notes:| 1. Don't post any source code here.| 2. Please be careful, leave short comments only. Don't spam here.| 3. For more discussion (hints, ideas, solutions) please visit our forum.| 4. Authors are allowed to delete the post and use html code here (e.g. to provide some useful links).||Notes:| 1. Don't post any source code here.| 2. Please be careful, leave short comments only. Don't spam here.| 3. For more discussion (hints, ideas, solutions) please visit our forum.| 4. Authors are allowed to delete the post and use html code here (e.g. to provide some useful links).||Notes:| 1. Don't post any source code here.| 2. Please be careful, leave short comments only. Don't spam here.| 3. For more discussion (hints, ideas, solutions) please visit our forum.| 4. Authors are allowed to delete the post and use html code here (e.g. to provide some useful links).| |
||||||
2023-03-04 07:52:42
hariu commentletsen baisan ahdaa mash ih bayrlalaa!! |
||||||
2022-11-06 05:36:02
belen budaa bitgii avaarai chi uuriiguu huurch bn boli boli zaza hara hara |
||||||
2021-06-21 07:37:16
huulaad herreggui |
||||||
2021-06-21 07:36:37
|Notes:| 1. Don't post any source code here.| 2. Please be careful, leave short comments only. Don't spam here.| 3. For more discussion (hints, ideas, solutions) please visit our forum.| 4. Authors are allowed to delete the post and use html code here (e.g. to provide some useful links).| |
||||||
2021-05-13 13:47:55
stringstream, vector ashiglaad bodwol gaigu amarhn ymbn |
||||||
2019-12-29 17:01:27
EOF ni "end of file" gesen ug |
||||||
2019-12-29 17:00:12
#include <iostream> using namespace std; int main() { int n = 1, s1 = 0, s2 = 0; int a[1001]; while(scanf("%d", &a[n]) != EOF) n++; n--; for(int i = 2; i < n; i++) { if(a[i] > a[i+1] && a[i] > a[i-1]) { s1++; } if(a[i] < a[i+1] && a[i] < a[i-1]) { s2++; } } printf("%d %d", s1, s2); return 0; } |