码迷,mamicode.com
首页 >  
搜索关键字:int    ( 143001个结果
编写一个程序,求出整数数组中最小元素的下标。如果这样的元素个数大于1,则返回下标最小的数的下标。
int[] num = new int[]{5,6,1,4,3,6,7,8,92,6};int min = num[0];int n = 0;for (int i = 0; i < num.length; i++) {if(num[i]<min){min = num[i];n = i;}}Syste...
分类:编程语言   时间:2015-04-12 15:58:52    阅读次数:1362
阿里巴巴2015实习生在线笔试题
1 #include 2 3 using namespace std; 4 5 class animal 6 { 7 public: 8 virtual void print_age(void)=0; 9 protected:10 int age;11 };12 class ...
分类:其他好文   时间:2015-04-12 15:58:41    阅读次数:144
输入一个五位正整数,使用数组判断它是不是回文数(例如12321是回文)
public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println("请输入一个五位正整数:"); int num = scan.nextInt(); Strin...
分类:编程语言   时间:2015-04-12 15:56:58    阅读次数:181
使用多重循环打印6阶杨辉三角
public static void main(String[] args) { int[][] a = new int[6][]; //a[0][0] = 1; for(int i=0;i<6;i++){ a[i]=new int[i+1]; } for(int i = 0 ...
分类:其他好文   时间:2015-04-12 14:49:38    阅读次数:162
单链表(不带头结点)
#include #include typedef int ElemType; typedef struct Node { ElemType data; struct Node *next; }LNode,*LinkList; void InitList(LinkList &l); void Create_head(LinkList &l); void Create_rear(Lin...
分类:其他好文   时间:2015-04-12 14:48:41    阅读次数:168
使用二重循环和break语句,找出2~100内所有的质数
public static void main(String[] args) { int m = 0; for(int i = 2 ; i < 100 ; i++){ for(int j = 2;j <= Math.sqrt(i)+1 ;j++){ m=i % j; if(m =...
分类:其他好文   时间:2015-04-12 14:48:28    阅读次数:86
ST表
比如维护一个最大值,注意初始化的log[0] = -1 Σ( ° △ °|||)︴逢写必错有木有! 1 #include 2 #include 3 #include 4 #include 5 #include 6 #define REP(i, s, n) for(int i = s; i ...
分类:其他好文   时间:2015-04-12 14:48:02    阅读次数:186
翻牌回朔法解题
#include #include using namespace std;class card{ private: int a[5][5];//原题 int b[5][5];//解决方案 int c[5][5];/...
分类:其他好文   时间:2015-04-12 14:45:41    阅读次数:139
将一个给定的整型数组转置输出(二维数组)
public static void main(String[] args) { int[][] a = new int[2][3]; int[][] b = new int[3][2]; int k = 1; System.out.println("转置前数组:"); for(int i...
分类:编程语言   时间:2015-04-12 14:44:58    阅读次数:126
有一个已经排好序的数组。现输入一个数,要求按原来的规律将它插入数组中。
public static void main(String[] args) { int[] a = {1,3,5,7,9,19,29,70}; int[] b = new int[a.length+1]; Scanner scan = new Scanner(System.in); Sys...
分类:编程语言   时间:2015-04-12 14:44:41    阅读次数:136
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!