解决方案 »
- java web 基础问题
- 请教关于如何学习j2ee的问题
- 今天我做web登录模块,成功登陆后显示一个登录用户的基本信息页面
- hibernate和jdk版本问题
- 有个疑问请高手解决
- oracle 10g as 里面怎么使用 JNDI 找到 SessionBean?
- 兄弟们 struts到底有无必要学啊?疑惑中 求教了
- 有哪位高手做过jsf, struts整合吗?救命啊
- “soundbox.ejbgrpx”: spaces in the temporary directory path may cause weblogic EJBC utility to produce fatal compile errors
- 有没有高手大哥给点指导,用jsp做OA
- spring+hibernate 如何自己将SessionFactroy设置到HibernateTemplate
- 省、市、区、字符串解析
boolean b=false;
for(long i=1;i<999999999;i++){
if(i%7==0 || include7(i)){
int k=0;
for(long j=i;j-i<=m;j++){
if(j%7==0 || include7(j)){
k++;
if(k==m){
System.out.println("连续"+m+"次拍手,第一次拍手的数为:"+(j-k));
b=true;
break;
}
}else break;
}
}else continue;
if(b) break;
}
}
static boolean include7(long i){
String str=String.valueOf(i);
if(str.indexOf("7")!=-1) return true;
return false;
}
int i = 1;
//连续次数
int lCount = 0;
int[] intArr = new int[count];
while(true){
System.out.println(i);
boolean isContinue = false;
for(int x = 0; x < count; x++){
//如果报到7的倍数(7,14,21,28……)或者包含数字7的数(7,17,27,37……)
if((i - x) != 0 && (i - x) % 7 == 0 || (i - x) % 10 == 7){
isContinue = true;
intArr[x] = (i - x);
}else{
isContinue = false;
break;
}
}
if(isContinue){
for(int j : intArr){
System.out.println(j);
}
break;
}
i++;
}
}
(i - x) % 10 == 7只能保证末尾是7~嗯,理解错误。static void intPaiShou(int count,int n){
int i = 1;
int[] intArr = new int[count];
while(true){
System.out.println(i);
boolean isContinue = false;
for(int x = 0; x < count; x++){
//如果报到7的倍数(7,14,21,28……)或者包含数字7的数(7,17,27,37……)
if((i - x) != 0 && (i - x) % 7 == 0 || (i - x) % 10 == 7 || include7(i - x)){
isContinue = true;
intArr[x] = (i - x);
}else{
isContinue = false;
break;
}
}
if(isContinue){
for(int j : intArr){
System.out.println("连续拍" + count + "手的num:" + j);
}
break;
}
i++;
}
}
static boolean include7(long i){
String str=String.valueOf(i);
return str != null && str.trim().indexOf("7") != -1;
}
这样修改即可