玩codehunter level02
来源:互联网 发布:java 就业培训机构 编辑:程序博客网 时间:2024/06/05 06:32
public class Program {
public static int[] Puzzle(int n) {
int[] test = new int[n];
for(int i=0; i<n; i++)
test[i]=i;
return test;
}
}
================================================
public class Program {
public static int[] Puzzle(int n) {
int[] test = new int[n];
for(int i=0; i<n; i++)
test[i] = i*n;
return test;
}
}
================================================
public class Program {
public static int[] Puzzle(int n) {
int[] test = new int[n];
for(int i=0; i<n; i++)
test[i] = i*i;
return test;
}
}
===============================================
public class Program {
public static int Puzzle(int[] v) {
int sum = 0;
for(int i=0;i < v.length; i++)
sum += v[i];
return sum;
}
}
================================================
public class Program {
public static int Puzzle(int n) {
int sum=0;
for(int i=0; i< n; i++)
sum += i*i;
return sum;
}
}
(系统显示还可以优化)
用平方和公式
===============================================
Rating 1:
public class Program {
public static int Puzzle(String s) {
int count =0;
for(int i=0;i<s.length();i++)
if(s.charAt(i)=='a')
count++;
return count;
}
}
有待优化
===============================================
Rating 2:
public class Program {
public static int Puzzle(String s, char x) {
int count=0;
for(int i=0; i<s.length();i++)
if(s.charAt(i)==x)
count++;
return count;
}
}
有待优化
================================================
- 玩codehunter level02
- Nebula level02
- 黑客入门之fusion level02
- 玩
- 玩
- 玩
- 玩
- 玩
- 玩
- 不太好玩
- 随意玩
- 玩游戏
- 去玩
- 玩火柴
- 玩游戏
- 玩 IHTMLElementCollection
- 玩视频
- 玩完
- 2012年5月SAT香港真题解析
- Android — 长按ListView 利用上下文菜单(ActionMode) 进行批量事件处理
- Mac下使用git入门
- Linux下Socket编程的端口问题( Bind error: Address already in use )
- 操作4 mongodb备份脚本
- 玩codehunter level02
- 关于connect: network is unreachable 问题的解决
- nginx + ngx_lua安装测试
- Mastering Dart(读书笔记)——有意思的地方在于它的Future、Isolates和Zones
- linux环境变量的临时设置,永久设置和其他。
- c++primer要点-表达式
- CodeForces 3DLeast Cost Bracket Sequence优先队列
- Android 分包机制
- 【设计模式】动态代理Proxy_02