Блог пользователя i_am_not_special

Автор i_am_not_special, история, 11 месяцев назад, По-английски
int n;

cin >> n;

int x;

cout << "digit" << endl;

cin >> x;

cout << "digit" << endl;

cin >> x;

vector v = {2, 3, 5, 7};

int i = 0;

int cnt = 0;

while(i < 4) {

cout << "div " << v[i] << endl;
   int x;
   cin >> x;
   cnt++;
   if(x == 0)
   { 
     if(i == 0 && cnt == 3)
     {
        break;
     }

    if(i == 0 && cnt == 4)
     {
          break;
     }

    if(i == 1 && cnt == 3)
    {
       break;
    }
     i++;
     cnt = 0;
   }

}

cout << "mul " << n << endl;
    cin >> x;
    cout <<"! " << endl;

I don't know why my solution is wrong please give me some idea why its wrong

Полный текст и комментарии »

  • Проголосовать: нравится
  • -8
  • Проголосовать: не нравится

Автор i_am_not_special, история, 17 месяцев назад, По-английски

You are given an array a of integers with n elements. You are allowed to rearrange the elements of the array in any order. Your task is to determine if it is possible to reorder the array such that for every i from 0 to n-2 (i.e., for all adjacent elements), the absolute difference between consecutive elements is either 5 or 7. That is, for all i such that 0 <= i < n — 1, you need to check if: abs(v[i] — v[i + 1]) = 5 or abs(v[i] — v[i+ 1]) = 7.

Полный текст и комментарии »

  • Проголосовать: нравится
  • -1
  • Проголосовать: не нравится

Автор i_am_not_special, история, 20 месяцев назад, По-английски

So the question is count the number of increasing subsequence such that the gcd of subsequence will be equal to 1.

1 <= size of array <= 1e5 1 <= a[i] <= 1e6

can anyone help me solve this problem.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +9
  • Проголосовать: не нравится