Бодолт илгээх | Бүх бодолтууд | Шилдэг бодолтууд | Жагсаалт руу буцах |
RGB5657 - Үг бүтээх |
3 дахь мөрөн дахь үсгүүдийг ашиглан эхний 2 мөрөн дэх үгийг үүсгэж болох уу? Нэг ч үсэг шинээр нэмэх болон нэг ч үсэг илүү гарах ёсгүй.
Input
Оролт нь латин том үсгээрх 3 мөрнөөс бүрдэнэ. Мөр тус бүрийн урт нь 100-аас хэтрэхгүй.
Output
Үг бүтээж болж байвал "YES", үгүй бол "NO" гэж хэвлэ.
Example
Input 1:
SANTACLAUS
DEDMOROZ
SANTAMOROZDEDCLAUS
Output 1:
YES
Input 2:
PAPAINOEL
JOULUPUKKI
JOULNAPAOILELUPUKKI
Output 2:
NO
Нэмсэн: | Bataa |
Огноо: | 2014-12-02 |
Хугацааны хязгаарлалт: | 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 |
Эх сурвалж: | Codeforces |
hide comments
|
|||||
2024-09-25 10:21:14
#include <stdio.h> int main() { int n, m; // Input: dimensions of the array printf("Enter the dimensions of the array (1 ≤ n, m < 100): "); scanf("%d %d", &n, &m); // Check if n and m are in the valid range if (n < 1 || n >= 100 || m < 1 || m >= 100) { printf("Invalid input! n and m must be between 1 and 99.\n"); return 1; } int A[n][m]; // Input: elements of the 2D array printf("Enter the elements of the array (%d x %d):\n", n, m); for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { scanf("%d", &A[i][j]); } } // Input: target number to search for int x; printf("Enter the number to search for: "); scanf("%d", &x); int found = 0; // Search for the number in the 2D array for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { if (A[i][j] == x) { printf("Found at: row %d, column %d\n", i + 1, j + 1); // 1-based index found = 1; } } } // If not found, print 1, -1 if (!found) { printf("1, -1\n"); } return 0; } |
|||||
2024-09-25 10:20:42
#include <stdio.h> int main() { int n, t; // Input: sizes of arrays A and B printf("Enter the sizes of the arrays (1 ≤ n, t < 100): "); scanf("%d %d", &n, &t); // Check if n and t are in the valid range if (n < 1 || n >= 100 || t < 1 || t >= 100) { printf("Invalid input! n and t must be between 1 and 99.\n"); return 1; } int A[n], B[t], C[n + t]; // Input: elements of array A printf("Enter %d elements for array A:\n", n); for (int i = 0; i < n; i++) { scanf("%d", &A[i]); } // Input: elements of array B printf("Enter %d elements for array B:\n", t); for (int i = 0; i < t; i++) { scanf("%d", &B[i]); } // Combine arrays A and B into array C for (int i = 0; i < n; i++) { C[i] = A[i]; } for (int i = 0; i < t; i++) { C[n + i] = B[i]; } // Output: combined array C printf("Combined array C:\n"); for (int i = 0; i < n + t; i++) { printf("%d ", C[i]); } printf("\n"); return 0; } |
|||||
2024-03-26 08:59:34
( ͡° ͜ʖ ͡°) Last edit: 2024-03-26 09:00:12 |
|||||
2023-11-04 05:15:28
|
|||||
2023-11-03 05:30:23
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
|||||
2023-03-14 05:00:41
#include <iostream> #include <string> #include <algorithm> using namespace std; int main() { string s1, s2, s3; cin >> s1 >> s2 >> s3; s1 += s2; sort(s1.begin(), s1.end()); sort(s3.begin(), s3.end()); if (s1 == s3) { cout << "YES\n"; } else { cout << "NO\n"; } return 0; } suguuuuudaaa hultsgaaaaa |
|||||
2023-02-06 03:29:50
GraphicsWindow.Title = "Banana" GraphicsWindow.BackgroundColor "Yellow" GraphicsWindow.Height = 300 GraphicsWindow.Width = 350 For i = 1 To 15 GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.Width = i GraphicsWindow.DrawLine(i * 20,20 i * 20, 180) ndFor GraphicsWindow.ShowMessage("Create wonderful desings and shapes in small basic", "message" |
|||||
2022-11-11 03:22:42
https://www.youtube.com/watch?v=dQw4w9WgXcQ |
|||||
2022-10-24 10:32:27
#include <iostream> #include <windows.h> using namespace std; struct SNAKE_POSITION { int X,Y; }; class family { static const int H; static const int W; char ** F; family(const family &); family operator=(const family &); public: family() { F = new char*[family::H]; for(int c = 0; c < family::H; ++c) { F[c] = new char[family::W]; } } ~family() { for(int c = 0; c < family::H; ++c) { delete[] F[c]; } delete[] F; } void print() { for(int c = 0; c < H; ++c) { for(int r = 0; r < W; ++r) { cout << F[c][r]; } cout << endl; } } void clear() { for(int c = 0; c < H; ++c) { for(int r = 0; r < W; ++r) { F[c][r] = ' '; } } } int get_W() const {return W;} int get_H() const {return H;} void draw(int y, int x, char what) { //y = (y < 0) ? 0 : (y >= H ? H - 1 : y); //x = (x < 0) ? 0 : (x >= W ? W - 1 : x); F[y][x] = what; } } F; class food_cls { SNAKE_POSITION pos; char symbol; public: food_cls(): symbol('X'), pos() { pos.X = pos.Y = -1; } void set_pos(int X, int Y) { pos.X = X; pos.Y = Y; } void reposition(const family & F) { pos.X = rand() % F.get_W(); pos.Y = rand() % F.get_H(); } int get_X() const {return pos.X;} int get_Y() const {return pos.Y;} char get_symbol() const {return symbol;} } food; class snake_cls { enum {UP, DOWN, LEFT, RIGHT} dir; char symbol, head_symbol; SNAKE_POSITION pos[100]; SNAKE_POSITION & head; int speed; int size; bool can_turn; public: snake_cls(int X, int Y): symbol('#'), head_symbol('@'), pos(), speed(1), size(1), dir(RIGHT), head(pos[0]), can_turn(true) { pos[0].X = X; pos[0].Y = Y; } bool check_food(const food_cls & food) { if(food.get_X() == head.X && food.get_Y() == head.Y) { size += 1; return true; } return false; } void get_input(const family & F) { if(GetAsyncKeyState(VK_UP) && dir != DOWN) { dir = UP; } if(GetAsyncKeyState(VK_DOWN) && dir != UP) { dir = DOWN; } if(GetAsyncKeyState(VK_LEFT) && dir != RIGHT) { dir = LEFT; } if(GetAsyncKeyState(VK_RIGHT) && dir != LEFT) { dir = RIGHT; } } void move(const family & F) { SNAKE_POSITION next = {0, 0}; switch(dir) { case UP: next.Y = -speed; break; case DOWN: next.Y = speed; break; case LEFT: next.X = -speed; break; case RIGHT: next.X = speed; } for(int c = size - 1; c > 0; --c) { pos[c] = pos[c-1]; } head.X += next.X; head.Y += next.Y; if(head.X < 0 || head.Y < 0 || head.X >= F.get_W() || head.Y >= F.get_H()) { throw "DEADD!!!!"; } } void draw(family & F) { for(int c = 0; c < size; ++c) { if(c == 0) { F.draw(pos[c].Y, pos[c].X, head_symbol); } else { F.draw(pos[c].Y, pos[c].X, symbol); } } } int get_X() const { return head.X; } int get_Y() const { return head.Y; } char get_symbol() const { return symbol; } } snake(1, 1); const int family::H = 24; const int family::W = 79; int main() { F.clear(); food.set_pos(5, 5); while(1) { F.clear(); snake.get_input(F); try { snake.move(F); } catch (const char * er) { F.clear(); cerr << er << endl; system("pause"); return -1; } snake.draw(F); F.draw(food.get_Y(), food.get_X(), food.get_symbol()); if(snake.check_food(food)) { food.reposition(F); } F.print(); Sleep(1000/30); system("cls"); } return 0; } |
|||||
2022-10-19 04:02:26
yaaaaj hiiiihynbeeeeeeeeeeeeeeeeeeeeeeeeee |