herrDeng網內搜尋
自訂搜尋
Ads
2014年5月6日 星期二
訂閱:
張貼留言 (Atom)
熱門文章
-
教育部為提昇全民資安素養與電腦防護能力,本部於101年9月5日至11月5日舉辦「全民資安素養自我評量」活動,請在活動期間內踴躍上網檢測資訊安全素養認知程度,並有機會參與抽獎,詳情請參閱活動網站(網址: https://isafe.moe.edu.tw/event
-
url="https://www.twse.com.tw/exchangeReport/STOCK_DAY?response=json&date=20220330&stockNo=2330"
-
先說明一下這是後知後覺的解答,所謂後知就是股票價格已知存在陣列(清單),當然就要用迴圈練習,雙迴圈暴力解需時O(n**2),當然不用,採python單一迴圈解答「最佳股票的買賣時機#LeetCode 121 Best Time to Buy and Sell Stock」,解...
-
你會用C的算子sizeof?
-
Python C++使用字串find迴圈速解Leetcode 2490 Circular Sentence C++ & Python都有字串的find,用法都類似 split=s.find(' ', split+1)能找到s從index=split+1開...
-
Python CPP heap priority queue速解L eetcode 2530. Maximal Score After Applying K Operations heap/priority queue是重要的資料結構,無論是C++的std::priority_q...
33 則留言:
package zz;
import java.util.Random;
public class jj {
public static void main(String[] args) {
Random rnd=new Random();
int [][] a= new int [7][8];
int count=0;
for(int i=0; i<a.length; i++){
for(int j=0; j<a[i].length; j++){
a[i][j]=rnd.nextInt(2);
System.out.print(a[i][j]);
if (a[i][j]==1) count++;
}
System.out.println();
}
System.out.println(count+"顆地雷!");
}
}
package aaa;
import java.util.Random;
public class bb {
public static void main(String[] args) {
Random rnd=new Random();
int [][] a= new int [7][8];
int count=0;
for(int i=0; i<a.length; i++){
for(int j=0; j<a[i].length; j++){
a[i][j]=rnd.nextInt(2);
System.out.print(a[i][j]);
if (a[i][j]==1) count++;
}
System.out.println();
}
System.out.println(count+"顆地雷!");
}
}
import java.util.Random;
public class zzz {
public static void main(String[] args) {
Random rnd=new Random();
int [][] a= new int [7][8];
int count=0;
for(int i=0; i<a.length; i++){
for(int j=0; j<a[i].length; j++){
a[i][j]=rnd.nextInt(2);
System.out.print(a[i][j]);
if (a[i][j]==1) count++;
}
System.out.println();
}
System.out.println(count+"顆地雷!");
}
}
import java.util.Random;
public class ex1 {
public static void main(String[] args) {
Random rnd=new Random();
int[][] a=new int[7][8];
int count=0;
for (int i=0;i<a.length;i++){
for(int j=0;j<a[i].length; j++){
a[i][j]=rnd.nextInt(2);
System.out.print(a[i][j]);
if (a[i][j]==1) count++;
}
System.out.println();
}
System.out.println(count+"顆地雷!");
int sum=0;
for (int x=2;x<=4;x++){
for (int z=3;z<=5;z++){
sum+=a[x][z];
}
}
System.out.print(sum-(a[3][4]));
}
}
package asas;
import java.util.Random;
public class xcxcxc {
public static void main(String[] args) {
Random rnd=new Random();
int [][] a= new int [7][8];
int count=0;
for(int i=0; i<a.length; i++){
for(int j=0;j<a.length;j++){
a[i][j]=rnd.nextInt(2);
System.out.print(a[i][j]);
if(a[i][j]==1) count++;
}
System.out.println();
}
System.out.println(count+"顆地雷");
System.out.print((a[2][3]+a[3][3]+a[4][3]+a[2][4]+a[3][5]+a[2][5]+a[3][5]+a[4][5]));
}
}
package asas;
import java.util.Random;
public class xcxcxc {
public static void main(String[] args) {
Random rnd=new Random();
int [][] a= new int [7][8];
int count=0;
for(int i=0; i<a.length; i++){
for(int j=0;j<a.length;j++){
a[i][j]=rnd.nextInt(2);
System.out.print(a[i][j]);
if(a[i][j]==1) count++;
}
System.out.println();
}
System.out.println(count+"顆地雷");
System.out.print("[3][4]周邊8個變數值的總和="+(a[2][3]+a[3][3]+a[4][3]+a[2][4]+a[3][5]+a[2][5]+a[3][5]+a[4][5]));
}
import java.util.Random;
public class ting {
public static void main(String[] args) {
Random rnd=new Random();
int[][] a=new int [7][8];
int count=0;
for(int i=0;i<a.length;i++){
for(int j=0;j<a[i].length;j++){
a[i][j]=rnd.nextInt(2);
System.out.print(a[i][j]);
if(a[i][j]==1) count++;
}
System.out.println();
}
System.out.println(count+"顆地雷!");
int sum=0;
for(int x=2;x<=4;x++){
for(int z=3;z<=5;z++){
sum+=a[x][z];
}
}
System.out.print(sum-(a[3][4]));
}
}
package fdgdgds;
import java.util.Random;
public class EFDSF {
public static void main(String[] args) {
Random rnd=new Random();
int [][] a= new int [7][8];
int count=0;
for(int i=0; i<a.length; i++){
for(int j=0;j<a.length;j++){
a[i][j]=rnd.nextInt(2);
System.out.print(a[i][j]);
if(a[i][j]==1) count++;
}
System.out.println();
}
System.out.println(count+"顆地雷");
System.out.print((a[2][3]+a[3][3]+a[4][3]+a[2][4]+a[3][5]+a[2][5]+a[3][5]+a[4][5]));
}
}
package roger;
import java.util.Random;
public class roger123 {
public static void main(String[] args) {
Random rnd=new Random();
int [][] a= new int [7][8];
int count=0;
for(int i=0; i<a.length; i++){
for(int j=0;j<a.length;j++){
a[i][j]=rnd.nextInt(2);
System.out.print(a[i][j]);
if(a[i][j]==1) count++;
}
System.out.println();
}
System.out.println(count+"顆地雷");
System.out.print((a[2][3]+a[3][3]+a[4][3]+a[2][4]+a[3][5]+a[2][5]+a[3][5]+a[4][5]));
}
}
package AWEFF;
import java.util.Random;
public class AAA {
public static void main(String[] args) {
Random rnd=new Random();
int [][] a= new int [7][8];
int count=0;
for(int i=0; i<a.length; i++){
for(int j=0;j<a.length;j++){
a[i][j]=rnd.nextInt(2);
System.out.print(a[i][j]);
if(a[i][j]==1) count++;
}
System.out.println();
}
System.out.println(count+"顆地雷");
System.out.print((a[2][3]+a[3][3]+a[4][3]+a[2][4]+a[3][5]+a[2][5]+a[3][5]+a[4][5]));
}
}
package she;
import java.util.*;
public class she1 {
public static void main(String[] args) {
Random rnd=new Random();
int [][] a= new int [7][8];
int count=0;
for(int i=0; i<a.length; i++){
for(int j=0;j<a.length;j++){
a[i][j]=rnd.nextInt(2);
System.out.print(a[i][j]);
if(a[i][j]==1) count++;
}
System.out.println();
}
System.out.println(count+"顆地雷");
System.out.print((a[2][3]+a[3][3]+a[4][3]+a[2][4]+a[3][5]+a[2][5]+a[3][5]+a[4][5])-a[3][4]);
}
}
import java.util.Random;
public class AS {
public static void main(String[] args) {
Random rnd=new Random();
int [][] a= new int [7][8];
int count=0;
for(int i=0; i<a.length; i++){
for(int j=0; j<a[i].length; j++){
a[i][j]=rnd.nextInt(2);
System.out.print(a[i][j]);
if(a[i][j]==1) count++;
}
System.out.println();
}
System.out.println(count+"顆地雷!");
}
}
package aaaa;
import java.util.Random;
public class QQQQQQ {
public static void main(String[] args) {
Random rnd=new Random();
int [][] a=new int [7][8];
int count=0;
for (int i=0;i<a.length; i++){
for(int j=0;j<a[i].length;j++){
a[i][j]=rnd.nextInt(2);
System.out.print(a[i][j]);
if (a[i][j]==1) count++;
}
System.out.println();
}
System.out.println(count+"顆地雷!");
}
}
package hello0506;
import java.util.Random;
public class Ex2 {
public static void main(String[] args) {
Random rnd= new Random();
int [][] a= new int [7][8];
int count=0;
for(int i=0; i<a.length; i++){
for(int j=0; j<a[i].length; j++){
a[i][j]=rnd.nextInt(2);
System.out.print(a[i][j]);
if (a[i][j]==1) count++;
}
System.out.println();
}
System.out.println(count+"顆地雷");
int sum=0;
for(int x=2;x<=4;x++){
for(int z=3;z<=5;z++){
sum+=a[x][z];
}
}
System.out.println(sum-(a[3][4]));
}
}
package hello506;
import java.util.Random;
public class Ex2 {
public static void main(String[] args) {
Random rnd=new Random();
int[][] a= new int[7][8];
int count=0;
for (int i=0;i<a.length;i++){
for(int j=0;j<a[i].length;j++){
a[i][j]=rnd.nextInt(2);
System.out.print(a[i][j]);
if (a[i][j]==1) count++;
}
System.out.println();
}
System.out.println(count+"顆地雷!");
System.out.print((a[2][3]+a[3][3]+a[4][3]+a[2][4]+a[3][5]+a[2][5]+a[3][5]+a[4][5]));
}
}
package hello0506;
import java.util.Random;
public class hello1 {
public static void main(String[] args) {
Random rnd= new Random();
int [][] a= new int [7][8];
int count=0;
for(int i=0; i<a.length; i++){
for(int j=0; j<a[i].length; j++){
a[i][j]=rnd.nextInt(2);
System.out.print(a[i][j]);
if (a[i][j]==1) count++;
}
System.out.println();
}
System.out.println(count+"顆地雷");
int sum=0;
for(int x=2;x<=4;x++){
for(int z=3;z<=5;z++){
sum+=a[x][z];
}
}
System.out.println(sum-(a[3][4]));
}
}
package hello0506;
import java.util.Random;
public class Ex2 {
public static void main(String[] args) {
Random rnd= new Random();
int [][] a= new int [7][8];
int count=0;
for(int i=0; i<a.length; i++){
for(int j=0; j<a[i].length; j++){
a[i][j]=rnd.nextInt(2);
System.out.print(a[i][j]);
if (a[i][j]==1) count++;
}
System.out.println();
}
System.out.println(count+"顆地雷");
int sum=0;
for(int x=2;x<=4;x++){
for(int z=3;z<=5;z++){
sum+=a[x][z];
}
}
System.out.println(sum-(a[3][4]));
}
}
package hello0506;
import java.util.Random;
public class Ex2 {
public static void main(String[] args) {
Random rnd= new Random();
int [][] a= new int [7][8];
int count=0;
for(int i=0; i<a.length; i++){
for(int j=0; j<a[i].length; j++){
a[i][j]=rnd.nextInt(2);
System.out.print(a[i][j]);
if (a[i][j]==1) count++;
}
System.out.println();
}
System.out.println(count+"顆地雷");
int sum=0;
for(int x=2;x<=4;x++){
for(int z=3;z<=5;z++){
sum+=a[x][z];
}
}
System.out.println(sum-(a[3][4]));
}
}
package hello0506;
import java.util.Random;
public class Ex2 {
public static void main(String[] args) {
Random rnd= new Random();
int [][] a= new int [7][8];
int count=0;
for(int i=0; i<a.length; i++){
for(int j=0; j<a[i].length; j++){
a[i][j]=rnd.nextInt(2);
System.out.print(a[i][j]);
if (a[i][j]==1) count++;
}
System.out.println();
}
System.out.println(count+"顆地雷");
int sum=0;
for(int x=2;x<=4;x++){
for(int z=3;z<=5;z++){
sum+=a[x][z];
}
}
System.out.println(sum-(a[3][4]));
}
}
package hello;
import java.util.Random;
public class ex2 {
public static void main(String[] args) {
Random rnd= new Random();
int [][] a= new int [7][8];
int count=0;
for(int i=0; i<a.length; i++){
for(int j=0; j<a[i].length; j++){
a[i][j]=rnd.nextInt(2);
System.out.print(a[i][j]);
if (a[i][j]==1) count++;
}
System.out.println();
}
System.out.println(count+"顆地雷");
int sum=0;
for(int x=2;x<=4;x++){
for(int z=3;z<=5;z++){
sum+=a[x][z];
}
}
System.out.println(sum-(a[3][4]));
}
}
package hello506;
import java.util.Random;
public class ex2 {
public static void main(String[] args) {
Random rnd=new Random();
int [][] a= new int [7][8];
int count=0;
for(int i=0; i<a.length; i++){
for(int j=0; j<a[i].length; j++){
a[i][j]=rnd.nextInt(2);
System.out.print(a[i][j]);
if (a[i][j]==1) count++;
}
System.out.println();
}
System.out.println(count+"顆地雷!");
count=0;
for(int i=2; i<=4; i++)
for(int j=3; j<=5; j++)
count+=a[i][j];
count-=a[3][4];
System.out.println(count);
}
}
package hello506;
import java.util.Random;
public class ex2 {
public static void main(String[] args) {
Random rnd=new Random();
int [][] a= new int [7][8];
int count=0;
for(int i=0; i<a.length; i++){
for(int j=0; j<a[i].length; j++){
a[i][j]=rnd.nextInt(2);
System.out.print(a[i][j]);
if (a[i][j]==1) count++;
}
System.out.println();
}
System.out.println(count+"顆地雷!");
count=0;
for(int i=2; i<=4; i++)
for(int j=3; j<=5; j++)
count+=a[i][j];
count-=a[3][4];
System.out.println(count);
}
}
package dh;
import java.util.Random;
public class jjjj {
public static void main(String[] args) {
Random rnd=new Random();
int [][] a=new int [7][8];
int count=0;
for(int i=0; i<a.length; i++){
for(int j=0; j<a[i].length; j++){
a[i][j]=rnd.nextInt(2);
System.out.print(a[i][j]==1?"x":"o");
if (a[i][j]==1) count++;
}
System.out.println();
}
System.out.println(count+"顆地雷");
int sum=0;
for(int i=2;i<=4;i++){
for(int j=3;j<=5;j++){
count+=a[i][j];
count-=a[3][4];
System.out.println(count);
}
}
}
}
package hhh;
import java.util.Random;
public class fff {
public static void main(String[] args) {
Random rnd=new Random();
int [][] a=new int [7][8];
int count=0;
for(int i=0; i<a.length; i++){
for(int j=0; j<a[i].length; j++){
a[i][j]=rnd.nextInt(2);
System.out.print(a[i][j]==1?"x":"o");
if (a[i][j]==1) count++;
}
System.out.println();
}
System.out.println(count+"顆地雷");
int sum=0;
for(int i=2;i<=4;i++){
for(int j=3;j<=5;j++){
count+=a[i][j];
count-=a[3][4];
System.out.println(count);
}
}
}
}
import java.util.Random;
public class hello2 {
public static void main(String[] args) {
Random rnd=new Random();
int [ ][ ]a= new int [7][8];
int count=0;
for(int i=0;i<a.length;i++){
for(int j=0;j<a[i].length;j++){
a[i][j]=rnd.nextInt(2);
System.out.print(a[i][j]);
if (a[i][j]==1) count++;
}
System.out.println();
}
System.out.println(count+"顆地雷!");
count=0;
for(int i=2; i<=4; i++)
for(int j=3; j<=5; j++)
count+=a[i][j];
count-=a[3][4];
System.out.println(count);
}
}
package agg;
import java.util.Random;
public class hdhd {
public static void main(String[] args) {
Random rnd=new Random();
int [][] a=new int [7][8];
int count=0;
for(int i=0; i<a.length; i++){
for(int j=0; j<a[i].length; j++){
a[i][j]=rnd.nextInt(2);
System.out.print(a[i][j]==1?"x":"o");
if (a[i][j]==1) count++;
}
System.out.println();
}
System.out.println(count+"顆地雷");
int sum=0;
for(int i=2;i<=4;i++){
for(int j=3;j<=5;j++){
count+=a[i][j];
count-=a[3][4];
System.out.println(count);
}
}
}
}
package ex0506;
import java.util.Random;
public class hello02 {
public static void main(String[] args) {
Random rnd=new Random();
int [][] a=new int[7][8];
int count=0;
for(int i=0;i<a.length;i++){
for(int j=0;j<a[i].length;j++){
a[i][j]=rnd.nextInt(2);
System.out.print(a[i][j]);
if(a[i][j]==1)count++;
}
System.out.println();
}
System.out.println(count+"顆地雷!");
count=0;
for(int i=2;i<=4;i++)
for(int j=3;j<=5;j++)
count+=a[i][j];
count-=a[3][4];
System.out.println(count);
}
}
package gg;
import java.util.Random;
public class jj {
public static void main(String[] args) {
Random rnd=new Random();
int [][] a=new int [7][8];
int count=0;
for(int i=0; i<a.length; i++){
for(int j=0; j<a[i].length; j++){
a[i][j]=rnd.nextInt(2);
System.out.print(a[i][j]==1?"x":"o");
if (a[i][j]==1) count++;
}
System.out.println();
}
System.out.println(count+"顆地雷");
int sum=0;
for(int i=2;i<=4;i++){
for(int j=3;j<=5;j++){
count+=a[i][j];
count-=a[3][4];
System.out.println(count);
}
}
}
}
package aaaaaaa;
import java.util.Random;
public class hhhhhhhhh {
public static void main(String[] args) {
Random rnd=new Random();
int [][] a=new int [7][8];
int count=0;
for(int i=0; i<a.length; i++){
for(int j=0; j<a[i].length; j++){
a[i][j]=rnd.nextInt(2);
System.out.print(a[i][j]==1?"x":"o");
if (a[i][j]==1) count++;
}
System.out.println();
}
System.out.println(count+"顆地雷");
int sum=0;
for(int i=2;i<=4;i++){
for(int j=3;j<=5;j++){
count+=a[i][j];
count-=a[3][4];
System.out.println(count);
}
}
}
}
package hello0506;
import java.util.Random;
public class hello {
public static void main(String[] args) {
Random rnd=new Random();
int [][] a= new int [7][8];
int count=0;
for(int i=0; i<a.length; i++){
for(int j=0;j<a[i].length;j++){
a[i][j]=rnd.nextInt(2);
System.out.print(a[i][j]);
if (a[i][j]==1) count++;
}
System.out.println();
}
System.out.println(count+"顆地雷!");
count=0;
for(int i=2; i<=4; i++)
for(int j=3; j<=5; j++)
count+=a[i][j];
count-=a[3][4];
System.out.println(count);
}
}
package roger;
import java.util.Random;
public class roger123 {
public static void main(String[] args) {
Random rnd=new Random();
int [][] a= new int [7][8];
int count=0;
for(int i=0; i<a.length; i++){
for(int j=0;j<a.length;j++){
a[i][j]=rnd.nextInt(2);
System.out.print(a[i][j]);
if(a[i][j]==1) count++;
}
System.out.println();
}
System.out.println(count+"顆地雷");
System.out.print((a[2][3]+a[3][3]+a[4][3]+a[2][4]+a[3][5]+a[2][5]+a[3][5]+a[4][5]));
}
}
package rgar;
import java.util.Random;
public class rgrgar {
public static void main(String[] args) {
Random rnd=new Random();
int [][] a= new int [7][8];
int count=0;
for(int i=0; i<a.length; i++){
for(int j=0;j<a.length;j++){
a[i][j]=rnd.nextInt(2);
System.out.print(a[i][j]);
if(a[i][j]==1) count++;
}
System.out.println();
}
System.out.println(count+"顆地雷");
System.out.print((a[2][3]+a[3][3]+a[4][3]+a[2][4]+a[3][5]+a[2][5]+a[3][5]+a[4][5]));
}
}
package az;
import java.util.Random;
public class 123j {
public static void main(String[] args) {
Random rnd=new Random();
int [][] a= new int [7][8];
int count=0;
for(int i=0; i<a.length; i++){
for(int j=0; j<a[i].length; j++){
a[i][j]=rnd.nextInt(2);
System.out.print(a[i][j]);
if (a[i][j]==1) count++;
}
System.out.println();
}
System.out.println(count+"顆地雷!");
}
}
張貼留言