C++. Задан двумерный массив A. Требуется поменять местами первую строку с первым столбцом, вторую строку со вторым и т.д. . Вывести получившийся двумерный массив.
def main(): for event in longpoll.listen(): if event.type == VkBotEventType.MESSAGE_NEW and (action := event.obj['message'].get('action')): if action['type'] == 'chat_kick_user': vk.messages.removeChatUser( chat_id=event.chat_id, user_id=action['member_id'], )
if __name__ == '__main__': main() Не забудьте, что боту необходимо выдать права администратора беседы
//PascalABC.NET версия 3.2, сборка 1389 //Если программа не запускается, то обновите версию uses System.Linq; begin begin writeln('I'); var n := ReadInteger('n='); Writeln((1 + 1 + Power(2, n - 1)) * n / 2); end;
begin writeln; writeln('II'); var n := ReadInteger('n='); Writeln(n mod 11 = 0 ? 'YES' : 'NO');
end;
begin writeln; writeln('III'); var a := ReadArrInteger('Документы', ReadInteger('n=')).ToList; writeln;
while a.Any() do begin write(a[0], ' '); a.RemoveAt(0); if not a.Any then break;
write(a.Last, ' '); a.RemoveAt(a.Count - 1); if not a.Any then break;
var n := 0; if a.Count > 1 then n := a.Count div 2 - 1; write(a[n], ' '); a.RemoveAt(n); end; end; end.
в первом вводе вводятся количество строк и столбцов
#include <iostream>
using namespace std;
int main() {
int colss,rowss;
cin >> cols >> rows;
int a[cols][rows];
for(int i = 0; i<cols; i++){
for(int j = 0; j<rows; j++){
cin >> a[i][j];
}
}
int b[rows][cols];
for(int i = 0; i<rows; i++){
for(int j = 0; j<cols; j++){
b[i][j] = a[j][i];
}
}
for(int i = 0; i<cols; i++){
for(int j = 0; j<rows; j++){
cout << b[i][j] << " ";
}
cout << endl;
}
return 0;
}