URGENTT!!
rezolvare problemele 213 214 215 de pe pbinfo.
Răspunsuri la întrebare
213
#include<bits/stdc++.h>
using namespace std;
int uc(int i, int j)
{
int m=(i*j)%10;
return m;
}
int main()
{
int n,a[25][25];
cin>>n;
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)
a[i][j]=uc(i, j);
for(int i=1;i<=n;i++)
{
if(i>1 and i<=n)
cout<<'\n';
for(int j=1;j<=n;j++)
cout<<a[i][j]<<" ";
}
return 0;
}
214
#include <iostream>
using namespace std;
int n, nr_cif = 0;
short a[11][11];
void cif(int x)
{
while(x)
{
nr_cif++;
x /= 10;
}
}
void read()
{
cin >> n;
cif(n);
}
int ultm_cif(int& n)
{
int c = n % 10;
n /= 10;
return c;
}
void solve()
{
for (short i = 1; i <= nr_cif; i++)
{
int c = ultm_cif(n);
for (short j = 1; j <= nr_cif; j++)
a[j][i] = c;
}
for (short i = 1; i <= nr_cif; i++, cout << endl)
for (short j = 1; j <= nr_cif; j++)
cout << a[i][j] << " ";
}
int main()
{
read();
solve();
}
215
#include <iostream>
using namespace std;
int n;
short a[7][7];
void read()
{
cin >> n;
}
int ultm_cif(int& n)
{
int c = n % 10;
n /= 10;
return c;
}
void solve()
{
for (short i = 1; i <= 6; i++)
{
int c = ultm_cif(n);
for (short j = i+1; j <= 6; j++)
a[i][j] = c;
for (short k = i+1; k <= 6; k++)
a[k][i] = c;
}
for (short i = 1; i <= 6; i++, cout << endl)
for (short j = 1; j <= 6; j++)
cout << a[i][j] << " ";
}
int main()
{
read();
solve();
}