Sofdor Ali's Magical Blackboard!

Limits: 277h46m40s, 512 MB

Sofdor Ali found interest in mathematics very early in his life. And now, he wants to spread this interest to every young mind. But the way some of the Bangladeshi schools asks students to memorize the multiplication table disappoints him. “Multiplication is just repeated addition”, Sofdor says to himself and grieves as many young students do not even know this simple fact.


This is a companion discussion topic for the original entry at https://toph.co/p/sofdor-alis-magical-blackboard

#include <stdio.h>

int main() {
int a,b,c,d=0,i;
scanf("%d",&a);
scanf("%d %d",&b,&c);
for(i=1;i<=c;i++){
d=d+b;
}
printf("%d",d);
return 0;
}

probelm???

First of all, Input will not contain only 3 integers it will contain. It will contain T number of input.
To solve this problem you will first need to get the value of T then you can use while loop to get T number of input.
A sample code.

int t;
scanf("%d", &t);
while(t--){
  //here you need to use scanf  to take value of A and B
  //then calculate the value and print it using printf
}

then what is the problem with my code?

#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
unsigned int a[t][2],r[t];
for(int i=0;i<t;i++)
{
cin>>a[i][0]>>a[i][1];
r[i]=0;
for(int j=0;j<a[i][1];j++)
{
r[i]=r[i]+a[i][0];
}
}
for(int i=0;i<t;i++)
cout<<r[i]<<endl;
}