248B - Chilly Willy - CodeForces Solution


math number theory *1400

Please click on ads to support us..

Python Code:

n = input()
if int(n) < 3:
    print(-1)
else:
    n = 10**(int(n)-1)
    ans = n//210
    ans = int(ans) + 1
    ans *= 210
    print(ans)
		 			   	  	    	 	 			 	   	

C++ Code:

#include<iostream>
#include<cmath>
using namespace std;

//50 80 170 20 200 110
int n;
int a[6]={50,80,170,20,200,110};
int b[6]={2,2,3,2,3,3};

int main(){
	cin>>n;
	if(n<3) cout<<"-1";
	else if(n==3) cout<<"210"; 
	else {
		cout<<"1";
		int x=(n-4)%6;
		for(int i=0;i<n-1-b[x];i++) cout<<"0";
		cout<<a[x];
	}
}
	 	 	  	 	  			  		   	 		  			


Comments

Submit
0 Comments
More Questions

1698A - XOR Mixup
1702E - Split Into Two Sets
1703B - ICPC Balloons
1702F - Equate Multisets
1700A - Optimal Path
665C - Simple Strings
1708A - Difference Operations
1703E - Mirror Grid
1042A - Benches
1676B - Equal Candies
1705B - Mark the Dust Sweeper
1711A - Perfect Permutation
1701B - Permutation
1692A - Marathon
1066A - Vova and Train
169B - Replacing Digits
171D - Broken checker
380C - Sereja and Brackets
1281B - Azamon Web Services
1702A - Round Down the Price
1681C - Double Sort
12A - Super Agent
1709A - Three Doors
1680C - Binary String
1684B - Z mod X = C
1003A - Polycarp's Pockets
1691B - Shoe Shuffling
1706A - Another String Minimization Problem
1695B - Circle Game
1702B - Polycarp Writes a String from Memory