B. Chilly Willy
来源:互联网 发布:淘宝女内裤真人秀图片 编辑:程序博客网 时间:2024/06/16 19:42
http://codeforces.com/problemset/problem/248/B
e , 看错题。。 找能被2,3,5,7整除的最小的数,要求长度为n 不会推,找的规律
#include <iostream>#include <cmath>#include <cstdlib>#include <string>using namespace std;const int maxx = 100000+10 ;//string s[maxn] ;int leng(long long x){ int len = 0 ; while(x){ x/=10 ; len++; } return len ;}long long tp ;long long Find(long long x,int l){ if(leng(x)>=l) { return tp = min(x,tp) ; } if(leng(x)<l) { tp = Find(x*3,l) ; tp = Find(x*5,l) ; tp = Find(x*2,l) ; tp = Find(x*7,l) ; }}void print(long long x){ long long t = x ; int num = 1 ; while(t>1){ if(t%2==0){ t/=2; num*=2; cout << (num) << endl; } if(t%3==0){ t/=3; num*=3; cout << num << endl; } if(t%5==0){ t/=5; num*= 5; cout << num << endl; } if(t%7==0){ t/=7; num*=7; cout << num << endl; } }}long long pow(long long &a,int x) { while(x--){ a*=10 ; } return a ;}/*2104 10505 100806 1001707 10000208 100002009 100000110*/int main(){ long long tmp ;// int i = 2 ;// for(long long j = 3 ; j < 18 ; ++j )// for(long long i = pow(10,j) ; ; ++i){// if(i%2==0&&i%3==0&&i%5==0&&i%7==0) {// cout << i <<endl;// break;// }// } int n ; string a[6] = {"110","050","080","170","020","200"} ; while(cin >> n){ if(n<3) cout << -1<<endl; else if(n==3) cout << 210 << endl; else { n-=3 ; cout << 1 ; for(int i = 1 ; i <= n-1 ; ++i){cout <<0;} cout << a[n%6] << endl; } } return 0 ;}
0 0
- B. Chilly Willy
- B. Chilly Willy
- Codeforce 248B Chilly Willy
- CodeForces 248B Chilly Willy
- CodeForces 248B Chilly Willy
- CodeForces 248B Chilly Willy
- Chilly Willy
- CodeForces 248B - Chilly Willy - 找规律
- codeforces 2184 B. Chilly Willy(规律)
- CodeForces 248B - Chilly Willy - 找规律
- Codeforces Round #152 (Div. 2) / 248B Chilly Willy (数论)
- [ZOJ1021] The Willy Memorial Program
- zoj1021 The Willy Memorial Program
- Billy, Willy and Moscow Underground
- zoj1021-The Willy Memorial Program(WA)- -!
- POJ 1073 The Willy Memorial Program 已被翻译
- 新GRE考试词汇相关的俚语:slapdash和willy-nilly
- b
- AndroidViewHover(Android高斯模糊低版本兼容)使用总结
- Costmap_2d Package (代价地图包)
- SCI与EI收录的外文期刊(计算机类)
- opencv-ios开发笔记7 神经网络 分类器
- 文章标题mysql 命令小记
- B. Chilly Willy
- MFC编程实例二:进度条的使用
- mybatis 的if else
- 学习HALCON放射变换
- 慕课网二次学习(五)
- 用AXIS2发布WebService的方法
- linux文件重命名
- Maybe I should pratice my Endlish
- 中国计算机核心期刊排名