Algorithm
Code Examples
#1 Code Example with C++ Programming
Code -
C++ Programming
#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
string n;
int count = 0;
while(t--){
cin>>n;
count = 0;
count += (stoi(n)%10 - 1) * 10;
if(n.size() == 1){
count += 1;
cout<<count<<endl;
continue;
}
if(n.size() == 2){
count += 3;
cout<<count<<endl;
continue;
}
if(n.size() == 3){
count += 6;
cout<<count<<endl;
continue;
}
if(n.size() == 4){
count += 10;
cout<<count<<endl;
continue;
}
}
return 0;
}
Copy The Code &
Try With Live Editor
Input
4
22
9999
1
777
22
9999
1
777
Output
13
90
1
66
1
66
Demonstration
Codeforcess solution 1433-A A. Boring Apartments ,C++, Java, Js and Python,1433-A,Codeforcess solution