Цепочка одинаковых символов заменяется на последовательность: количество повторений и сам символ.
7A1P1E1L1S1I7N
1) a x b = 1 при a=1 возможно (если b=1)
2) a x b = 1 при а=0 противоречиво, результат 0
3) a + b = 0 при a=1 противоречиво, результат 1
4) a + b = 1 при a=0 возможно (если b=1)
12 в десятичное - 110 в троичной.
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<span>using</span><span>System</span><span>;</span>
<span>class</span> Summa <span>{</span><span>static</span><span>void</span> Main<span>(</span><span>)</span><span>{</span><span>int</span> n <span>=</span> Convert<span>.</span><span>ToInt32</span><span>(</span>Console<span>.</span><span>ReadLine</span><span>(</span><span>)</span><span>)</span><span>;</span><span>int</span> i<span>;</span><span>int</span> sum <span>=</span><span>0</span><span>;</span><span>for</span><span>(</span>i<span>=</span><span>1</span><span>;</span> i <span><=</span>n<span>;</span> i<span>++</span><span>)</span><span>{</span>
sum <span>=</span> i<span>+</span>i<span>;</span><span>}</span>
Console<span>.</span><span>WriteLine</span><span>(</span>sum<span>)</span><span>;</span><span>}
</span>