DL Руководство пользователя
Ключ
Эти линии были удалены. Это слово было удалено.
Эти линии были добавлены. Это слово было добавлено.

Просмотр истории страницы


Есть 19 изменений. Просмотреть первое изменение .

 {noformat} \- 1. Маленькие хитрости 
  \- 1. Маленькие хитрости 
 &nbsp; &nbsp; &nbsp;\- контроль корректности при исполнении программы&nbsp; &nbsp; &nbsp; &nbsp;assert(z\[i\] \!= LLONG_MAX);&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;\- измерение времени выполнения и производительности процесора&nbsp; &nbsp; &nbsp; &nbsp;cerr << fixed << setprecision(0)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; << "TIME = " << clock() / (ld)CLOCKS_PER_SEC * 1000 << "\n";&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;\- для выхода из множества циклов внутри процедуры&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;return 0
 &nbsp; &nbsp; &nbsp;\- 1LL - константа 1 типа long long&nbsp; &nbsp; &nbsp; &nbsp;ans+=1LL*(выражение типа int), когда сумма превысит int
 &nbsp; &nbsp; &nbsp;\- да и нет по русски&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#include <bits/stdc++.h>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;using namespace std;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;int main()&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;int n,m,a\[50\],i;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;char d,dd,u,uu,uuu;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;d=164; dd=160; u=173; uu=165; uuu=226;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cin >> m >> n;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for(i=0;i<n;i++) cin >> a\[i\]; i=0;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;while(i<n && a\[i\]\!=m) i++;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if(i==n) cout << u << uu << uuu;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;else cout << d << dd;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
  
&nbsp; &nbsp; &nbsp;\- контроль корректности при исполнении программы
  
 &nbsp; &nbsp; &nbsp; &nbsp;assert(z\[i\] \!= LLONG_MAX);
  
 &nbsp; &nbsp;
  
 &nbsp; &nbsp; &nbsp;\- измерение времени выполнения и производительности процесора
  
 &nbsp; &nbsp; &nbsp; &nbsp;cerr << fixed << setprecision(0)
  
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; << "TIME = " << clock() / (ld)CLOCKS_PER_SEC * 1000 << "\n";
  
 &nbsp;&nbsp;
  
 &nbsp; &nbsp; &nbsp;\- для выхода из множества циклов внутри процедуры&nbsp;
  
 &nbsp; &nbsp; &nbsp; &nbsp;return 0
  
 &nbsp; &nbsp; &nbsp;\- 1LL - константа 1 типа long long
  
 &nbsp; &nbsp; &nbsp; &nbsp;ans+=1LL*(выражение типа int), когда сумма превысит int
  
 &nbsp; &nbsp; &nbsp;\- да и нет по русски
  
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#include <bits/stdc++.h>
  
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;using namespace std;
  
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
  
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;int main()
  
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{
  
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;int n,m,a\[50\],i;
  
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;char d,dd,u,uu,uuu;
  
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;d=164; dd=160; u=173; uu=165; uuu=226;
  
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cin >> m >> n;
  
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for(i=0;i<n;i++) cin >> a\[i\]; i=0;
  
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;while(i<n && a\[i\]\!=m) i++;
  
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if(i==n) cout << u << uu << uuu;
  
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;else cout << d << dd;
  
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}
  
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
  
 0. Для передачи значения обратно из функции в вызывающую программу
  
 &nbsp; &nbsp;пишем знак & (передать адрес), например
  
 &nbsp; &nbsp; &nbsp;bool Good(int &x) {...}&nbsp;
  
 &nbsp; &nbsp;Пример
  
 &nbsp; &nbsp; &nbsp;#include <bits/stdc++.h>
  
 &nbsp; &nbsp; &nbsp;using namespace std;
  
 &nbsp; &nbsp; &nbsp;
  
 &nbsp; &nbsp; &nbsp;void Split(int x, int &x1, int &x2, int &x3)
  
 &nbsp; &nbsp; &nbsp; &nbsp;{
  
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;x1=x%10;
  
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;x3=x/100;
  
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;x2=(x/10) % 10;
  
 &nbsp; &nbsp; &nbsp; &nbsp;}
  
 &nbsp; &nbsp; &nbsp;
  
 &nbsp; &nbsp; &nbsp;int main()
  
 &nbsp; &nbsp; &nbsp;{
  
 &nbsp; &nbsp; &nbsp; int i,i1,i2,i3,
  
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; j,j1,j2,j3,
  
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; n,a2,a3;
  
 &nbsp; &nbsp; &nbsp; cin >> n;
  
 &nbsp; &nbsp; &nbsp; ...
  
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Split(i,i1,i2,i3);
  
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Split(j,j1,j2,j3);
  
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (((i1+i2+i3)==(j1+j2+j3)) && (abs(i-j)>a3))
  
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; a3=abs(i-j);
  
 &nbsp; &nbsp; &nbsp;
  
 &nbsp; &nbsp; &nbsp;}
  
 1. Порядок вычисления логических выражений&nbsp;
  
 &nbsp; &nbsp;Для &nbsp;&& слева направо
  
 &nbsp; &nbsp;&& гарантирует что второй операнд не вычисляется, если первый - ложь.
  
  0. Для передачи значения обратно из функции в вызывающую программу&nbsp; &nbsp;пишем знак & (передать адрес), например&nbsp; &nbsp; &nbsp;bool Good(int &x) {...}&nbsp;
 &nbsp; &nbsp;Пример&nbsp; &nbsp; &nbsp;#include <bits/stdc++.h>&nbsp; &nbsp; &nbsp;using namespace std;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;void Split(int x, int &x1, int &x2, int &x3)&nbsp; &nbsp; &nbsp; &nbsp;{&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;x1=x%10;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;x3=x/100;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;x2=(x/10) % 10;&nbsp; &nbsp; &nbsp; &nbsp;}&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;int main()&nbsp; &nbsp; &nbsp;{&nbsp; &nbsp; &nbsp; int i,i1,i2,i3,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; j,j1,j2,j3,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; n,a2,a3;&nbsp; &nbsp; &nbsp; cin >> n;&nbsp; &nbsp; &nbsp; ...&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Split(i,i1,i2,i3);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Split(j,j1,j2,j3);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (((i1+i2+i3)==(j1+j2+j3)) && (abs(i-j)>a3))&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; a3=abs(i-j);&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;}
 1. Порядок вычисления логических выражений&nbsp;&nbsp; &nbsp;Для &nbsp;&& слева направо&nbsp; &nbsp;&& гарантирует что второй операнд не вычисляется, если первый - ложь.
 &nbsp; &nbsp;while ( (k<=es) && (s\[k\]\!=t) &nbsp;) k++;
 
 &nbsp; &nbsp;к s\[k\] не происходит обращения, если k>es
2. iostream::sync_with_stdio(false);&nbsp; &nbsp;cin.tie(NULL);&nbsp; &nbsp;\- для ускорения потокового ввода
  
2. iostream::sync_with_stdio(false);
  
 &nbsp; &nbsp;cin.tie(NULL);
  
 &nbsp; &nbsp;\- для ускорения потокового ввода
  
 3. &nbsp;Объявление файлов&nbsp;
 
 &nbsp; &nbsp;(стандартный потоковый ввод-вывод)
&nbsp; &nbsp;ifstream cin("round.in");&nbsp; &nbsp;ofstream cout("round.out");&nbsp;&nbsp; &nbsp;или так
 &nbsp; &nbsp;freopen("auto.in", "r", stdin);&nbsp; &nbsp;freopen("auto.out", "w", stdout);
 &nbsp; &nbsp;или так - потоковый ввод-вывод&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;с файловыми переменными fin fout
 &nbsp; &nbsp;ifstream fin("perimeter.in");&nbsp; &nbsp;ofstream fout("perimeter.out");&nbsp; &nbsp;fin &nbsp;>> n;&nbsp; &nbsp;fout << n;
 &nbsp; &nbsp;Работа с файлом, если он есть&nbsp;&nbsp; &nbsp;и с клавиатурой в противном случае
 &nbsp; &nbsp;if (fopen("boarding.in", "r"))&nbsp;&nbsp; &nbsp; &nbsp;{&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;freopen("boarding.in", "r", stdin);&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;freopen("boarding.out", "w", stdout);&nbsp;&nbsp; &nbsp; &nbsp;}
  
&nbsp; &nbsp;ifstream cin("round.in");
  
 &nbsp; &nbsp;ofstream cout("round.out");\\
  
 &nbsp; &nbsp;или так
  
 &nbsp; &nbsp;freopen("auto.in", "r", stdin);
  
 &nbsp; &nbsp;freopen("auto.out", "w", stdout);
  
 &nbsp; &nbsp;или так - потоковый ввод-вывод&nbsp;
  
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;с файловыми переменными fin fout
  
 &nbsp; &nbsp;ifstream fin("perimeter.in");
  
 &nbsp; &nbsp;ofstream fout("perimeter.out");
  
 &nbsp; &nbsp;fin &nbsp;>> n;
  
 &nbsp; &nbsp;fout << n;
  
 &nbsp; &nbsp;Работа с файлом, если он есть&nbsp;
  
 &nbsp; &nbsp;и с клавиатурой в противном случае
  
 &nbsp; &nbsp;if (fopen("boarding.in", "r"))&nbsp;
  
 &nbsp; &nbsp; &nbsp;{&nbsp;
  
 &nbsp; &nbsp; &nbsp; &nbsp;freopen("boarding.in", "r", stdin);&nbsp;
  
 &nbsp; &nbsp; &nbsp; &nbsp;freopen("boarding.out", "w", stdout);&nbsp;
  
 &nbsp; &nbsp; &nbsp;}
  
 &nbsp; &nbsp;Работа с файлом, на своей машине&nbsp;
  
 &nbsp; &nbsp;и с клавиатурой/экраном на DL
  
 &nbsp; &nbsp;#ifndef CONTEST
  
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ifstream cin("input.txt");
  
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ofstream cout("output.txt");
  
 &nbsp; &nbsp;#endif
  
  &nbsp; &nbsp;Работа с файлом, на своей машине&nbsp;&nbsp; &nbsp;и с клавиатурой/экраном на DL
 &nbsp; &nbsp;#ifndef CONTEST&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ifstream cin("input.txt");&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ofstream cout("output.txt");&nbsp; &nbsp;#endif
 &nbsp; &nbsp;Работа до конца входного файла
 
 &nbsp; &nbsp;ifstream cin("input.txt");
  
 &nbsp; &nbsp;ofstream cout("output.txt");
  
 &nbsp; &nbsp;cin >> a;
  
 &nbsp; &nbsp;while (not cin.eof())&nbsp;
  
 &nbsp; &nbsp; &nbsp;{
  
 &nbsp; &nbsp; &nbsp; &nbsp;...
  
 &nbsp; &nbsp; &nbsp; &nbsp;cin >> a;
  
 &nbsp; &nbsp; &nbsp;}
  
 4. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Знаковые &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
  
 &nbsp; &nbsp;2 байта - int &nbsp;&nbsp;
  
 &nbsp; &nbsp;4 байта - long int
  
 &nbsp; &nbsp;8 байт &nbsp;\- long long
  
  &nbsp; &nbsp;ifstream cin("input.txt");&nbsp; &nbsp;ofstream cout("output.txt");
 &nbsp; &nbsp;cin >> a;&nbsp; &nbsp;while (not cin.eof())&nbsp;&nbsp; &nbsp; &nbsp;{&nbsp; &nbsp; &nbsp; &nbsp;...&nbsp; &nbsp; &nbsp; &nbsp;cin >> a;&nbsp; &nbsp; &nbsp;}
 4. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Знаковые &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;2 байта - int &nbsp;&nbsp;&nbsp; &nbsp;4 байта - long int&nbsp; &nbsp;8 байт &nbsp;\- long long
 &nbsp; &nbsp;беззнаковые &nbsp;\- unsigned (int, long int, long long)
  
5. Константы
  5. Константы&nbsp; &nbsp;#define MaxN 1e5;&nbsp;&nbsp; &nbsp;const int MaN = 1e5;
 6. ans = (ans==INF) ? \-1 : ans; &nbsp;// если ans=INF занесnи туда \-1&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; условие &nbsp; &nbsp; true &nbsp;false
  
&nbsp; &nbsp;#define MaxN 1e5;&nbsp;
  7. Как вернуть значение в вызывающую программу ?&nbsp; &nbsp;\- написать & перед именем переменной&nbsp;&nbsp; &nbsp; &nbsp; то есть в подпрограмму передаётся не значение, а адрес&nbsp; &nbsp; &nbsp; и потому в подпрограмме модифицируется сама переменная&nbsp; &nbsp; &nbsp; из вызывающей программы
  
&nbsp; &nbsp;const int MaN = 1e5;
  &nbsp; &nbsp; &nbsp; bool Found(int &x, int &y)&nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int i=0; i<8; i++)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int j=0; j<8; j++)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (not Marked\[i\]\[j\])&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; { x=i; y=j; return true;};&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return false;&nbsp; &nbsp; &nbsp; &nbsp; }
  
6. ans = (ans==INF) ? \-1 : ans; &nbsp;// если ans=INF занесnи туда \-1
  
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; условие &nbsp; &nbsp; true &nbsp;false
  
 7. Как вернуть значение в вызывающую программу ?
  
 &nbsp; &nbsp;\- написать & перед именем переменной&nbsp;
  
 &nbsp; &nbsp; &nbsp; то есть в подпрограмму передаётся не значение, а адрес
  
 &nbsp; &nbsp; &nbsp; и потому в подпрограмме модифицируется сама переменная
  
 &nbsp; &nbsp; &nbsp; из вызывающей программы
  
 &nbsp; &nbsp; &nbsp; bool Found(int &x, int &y)
  
 &nbsp; &nbsp; &nbsp; &nbsp; {
  
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int i=0; i<8; i++)
  
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int j=0; j<8; j++)
  
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (not Marked\[i\]\[j\])
  
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; { x=i; y=j; return true;};
  
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return false;
  
 &nbsp; &nbsp; &nbsp; &nbsp; }
  
 8. Работа в Codeblocks
 
 &nbsp; &nbsp; &nbsp;\- ДУБЛИРОВАНИЕ СТРОКИ
  
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ctrl+D
  
 &nbsp; &nbsp; &nbsp;\- СДВИГ ТЕКСТА ВПРАВО/ВЛЕВО
  
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;отмечаем несколько строк и можно сдвигать их&nbsp;
  
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;вправо - клавишей &nbsp; TAB
  
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;влево &nbsp;\- клавишами &nbsp;Shift + TAB
  
  &nbsp; &nbsp; &nbsp;\- ДУБЛИРОВАНИЕ СТРОКИ&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ctrl+D&nbsp; &nbsp; &nbsp;\- СДВИГ ТЕКСТА ВПРАВО/ВЛЕВО&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;отмечаем несколько строк и можно сдвигать их&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;вправо - клавишей &nbsp; TAB&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;влево &nbsp;\- клавишами &nbsp;Shift + TAB
 9. Массив инициализируется нулями при объявлении?
 
 Массивы в C+\+ по стандарту по умолчанию не обнуляются.
  
 Но для обнуления есть отдельный краткий синтаксис:
  
 http://stackoverflow.com/questions/1920430/c-array-initialization
  
 Поэтому можно писать по вкусу:
  
 int a\[10\] = {0};
  
 int a\[10\] = {};
  
 int a\[10\] {0};
  
 int a\[10\] {};
  
 Тогда отдельный обнуляющий цикл не понадобится.\\
  
 &nbsp; &nbsp;Некоторые компиляторы, такие как GCC, заполняют все элементы массива нулями при его создании.
  
 &nbsp; &nbsp;https://code-live.ru/post/cpp-arrays/
  
  Массивы в C+\+ по стандарту по умолчанию не обнуляются.Но для обнуления есть отдельный краткий синтаксис:http://stackoverflow.com/questions/1920430/c-array-initialization
 Поэтому можно писать по вкусу:int a\[10\] = {0};int a\[10\] = {};int a\[10\] {0};int a\[10\] {};
 Тогда отдельный обнуляющий цикл не понадобится.
 &nbsp;&nbsp; &nbsp;Некоторые компиляторы, такие как GCC, заполняют все элементы массива нулями при его создании.&nbsp; &nbsp;https://code-live.ru/post/cpp-arrays/
 &nbsp; &nbsp;А вот эта программа без ручного обнуления не проходит:&nbsp;
 
 \#include <bits/stdc++.h>
  
 using namespace std;
  
 int main()&nbsp;
  
 {
  
 &nbsp; freopen("input.txt", "r", stdin);
  
 &nbsp; freopen("output.txt", "w", stdout);
  
  {code:title=p3.cpp\|borderStyle=solid}\#include <bits/stdc++.h>using namespace std;
 int main()&nbsp;{&nbsp; freopen("input.txt", "r", stdin);&nbsp; freopen("output.txt", "w", stdout);
 &nbsp; int g\[15\],n,m,k,i,x,y,ans;
 
 &nbsp; cin>> n >> m >> k;
 
 &nbsp; for (i=0; i<n; i++) g\[i\]=0; &nbsp; &nbsp; &nbsp; &nbsp; // без этого оператора не сдаётся
  
 &nbsp; for (i=0; i<n; i++)
  
 &nbsp; &nbsp; {
  
 &nbsp; &nbsp; &nbsp; cin >> x >> y;
  
 &nbsp; &nbsp; &nbsp; g\[--x\]=1; g\[--y\]=1;
  
 &nbsp; &nbsp; }
  
 &nbsp; ans=0;
  
 &nbsp; for (i=0; i<n; i++)
  
 &nbsp; &nbsp; if (g\[i\]==0) ans++;
  
 &nbsp; cout << ans;
  
 }{noformat}&nbsp;\\
  &nbsp; for (i=0; i<n; i++)&nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; cin >> x >> y;&nbsp; &nbsp; &nbsp; g\[--x\]=1; g\[--y\]=1;&nbsp; &nbsp; }&nbsp; ans=0;&nbsp; for (i=0; i<n; i++)&nbsp; &nbsp; if (g\[i\]==0) ans++;&nbsp; cout << ans;}{code}
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: http://www.atlassian.com/software/confluence Build:#2.6.1 916) - Ошибка/новая особенность - Свяжитесь с Администраторами