java数独求解大神帮一下忙!!

烦请各位大神解一下这个数独其实,这是一个小学一年级数学题(在下已经丢过人了,所以想找个帮手)_百度作业帮
烦请各位大神解一下这个数独其实,这是一个小学一年级数学题(在下已经丢过人了,所以想找个帮手)
烦请各位大神解一下这个数独其实,这是一个小学一年级数学题(在下已经丢过人了,所以想找个帮手)
这不算真正的数独,答案有很多的,举部分答案如下:数独九宫格求解,567****38 832***14* ****38756 *******962 675921*** 25961**** *41***625 78****391 知道的朋友把还有3道也解一下,我打不好,但还有3道和这一道是在一起的做过的朋友帮下忙吧!_百度作业帮
数独九宫格求解,567****38 832***14* ****38756 *******962 675921*** 25961**** *41***625 78****391 知道的朋友把还有3道也解一下,我打不好,但还有3道和这一道是在一起的做过的朋友帮下忙吧!
数独九宫格求解,567****38 832***14* ****38756 *******962 675921*** 25961**** *41***625 78****391 知道的朋友把还有3道也解一下,我打不好,但还有3道和这一道是在一起的做过的朋友帮下忙吧!
你的题有点乱,应该就是这样请帮我做一下这道数独.5()()2()() 7 4()1()()()7 3 6 ()()2()9()4()3()()()5()4 3()()7 8 3()()()()9()()64 1()()2()()9()()_百度作业帮
请帮我做一下这道数独.5()()2()() 7 4()1()()()7 3 6 ()()2()9()4()3()()()5()4 3()()7 8 3()()()()9()()64 1()()2()()9()()
请帮我做一下这道数独.5()()2()() 7 4()1()()()7 3 6 ()()2()9()4()3()()()5()4 3()()7 8 3()()()()9()()64 1()()2()()9()()()1()5()2()4()()4 8 6()()()5()2 5 ()()4()()7
.---------.---------.---------.| 5
1 |:---------+---------+---------:| 9
3 |:---------+---------+---------:| 8
7 |'---------'---------'---------'非常简单的题目哟.基本全是显性唯一数,请检验数独乐趣在于解的过程.建议自己没事时可以解一下.求大神帮一下忙呀~~~谢谢啦_java吧_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0成为超级会员,使用一键签到本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:292,947贴子:
求大神帮一下忙呀~~~谢谢啦收藏
再加一个每过一级加速的功能,谢谢各位大神啦public class Myblock extends JFrame {
private static final long serialVersionUID = 1L;
public static void main(String[] args){
final JFrame frame = new JFrame("俄罗斯方块。。。");
final Tetrisblok a = new Tetrisblok();
frame.addKeyListener(a);
frame.add(a);
final Timer timer = new Timer(800, a.new TimerListener());
timer.start();
JMenuBar menu = new JMenuBar();
frame.setJMenuBar(menu);
//定义游戏菜单项
JMenu gameMenu = new JMenu("游戏(G)");
JMenuItem newitem = new JMenuItem("新游戏(N)");
gameMenu.add(newitem);
final JMenuItem pauseitem = new JMenuItem("暂停(P)");
gameMenu.add(pauseitem);
JMenuItem contitem = new JMenuItem("继续(c)");
gameMenu.add(contitem);
JMenuItem exititem = new JMenuItem("退出(E)");
gameMenu.add(exititem);
//添加监听器来实现游戏菜单上的各个菜单项的功能,采用匿名内部类
//新游戏菜单项的功能实现
newitem.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
a.newmap();
a.drawwall();
a.score = 0;
a.level = 1;
a.blockType=a.ran.nextInt(7);
a.turnState=a.ran.nextInt(4);
a.nextb=a.ran.nextInt(7);
a.nextt=a.ran.nextInt(4);
//暂停菜单项的功能实现
pauseitem.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
timer.stop();
pauseitem.setEnabled(false);
//继续菜单项的功能实现
contitem.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
timer.start();
pauseitem.setEnabled(true);
//退出菜单项的功能实现
exititem.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
timer.stop();
Object[] options = { "是的,我要退出", "不好意思,点错了" };
int option = JOptionPane.showOptionDialog(null, "您确定要退出吗?",
"退出提示....",JOptionPane.OK_CANCEL_OPTION,JOptionPane.WARNING_MESSAGE,
null,options, options[0]);
if(option == JOptionPane.OK_OPTION){
System.exit(0);
timer.start();
//定义帮助菜单项
JMenu helpMenu = new JMenu("帮助(H)");
JMenuItem aboutitem = new JMenuItem("关于游戏(G)");
helpMenu.add(aboutitem);
JMenuItem writeitem = new JMenuItem("关于作者(W)");
helpMenu.add(writeitem);
helpMenu.addSeparator();
JMenuItem adviitem = new JMenuItem("游戏忠告(A)");
helpMenu.add(adviitem);
//添加监听器来实现帮助菜单上的各个菜单项的功能,采用匿名内部类
//关于游戏菜单项的功能实现
aboutitem.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
timer.stop();
JOptionPane.showMessageDialog(frame,"");
timer.start();
//关于作者菜单项的功能实现
writeitem.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
timer.stop();
JOptionPane.showMessageDialog(frame,"");
timer.start();
//游戏忠告菜单项的功能实现
adviitem.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
timer.stop();
JOptionPane.showMessageDialog(frame,"抵制不良游戏 , 拒绝盗版游戏\n\n注意自我保护 , 谨防受骗上当\n\n" +
"适度游戏益脑 , 沉迷游戏伤身\n\n合理安排时间 , 享受健康生活\n","健康游戏忠告。。。", RMATION_MESSAGE);
timer.start();
menu.add(gameMenu);
menu.add(helpMenu);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setBounds(500,100,400,520);
frame.setVisible(true);
frame.setResizable(false);
// 创建一个俄罗斯方块类class Tetrisblok extends JPanel implements KeyListener { private static final long serialVersionUID = 1L; Random ran = new Random(); //使用Random函数;
public int blockT // blockType代表方块类型
public int score = 0; //分数;
public int level = 1;
public int turnS // turnState代表方块状态 //方块起始位置的横坐标 //方块起始位置的纵坐标
public int nextb = ran.nextInt(7); //下一个方块类型;
public int nextt = ran.nextInt(4); //下一个方块的形状;
private int i = 0;
private int j = 0;
private boolean flag =
int[][] map = new int[13][23];
Tetrisblok(){
newblock();
drawwall();
//第一组代表方块的形状,方块形状类型有S、Z、L、J、I、O、T 7种
//第二组代表方块旋转几次
//第三四组为方块矩阵
private final int shapes[][][] =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0, 0, 0, 0, 0 },
{ 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } },
// 左l型方块
{ { 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0 },
{ 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 } },
// t型方块
{ { 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 },
{ 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0 } } };
// 生成新方块的方法
public void newblock(){
blockType =
turnState =
nextb = ran.nextInt(7);
nextt = ran.nextInt(4);
if (gameover(x, y)){
JOptionPane.showMessageDialog(null,"不好意思,游戏结束,请再接再厉!");
drawwall();
score = 0;
// 判断游戏结束的方法
public boolean gameover(int x, int y){
if (blow(x, y, blockType, turnState)){
// 是否合法的方法
public boolean blow(int x, int y, int blockType, int turnState){
for (int a = 0; a & 4; a++) {
for (int b = 0; b & 4; b++){
if (((shapes[blockType][turnState][a * 4 + b] == 1) && (map[x+ b + 1][y + a] == 1))
|| ((shapes[blockType][turnState][a * 4 + b] == 1) && (map[x+ b + 1][y + a] == 2))){
// 初始化地图
public void newmap(){
for (i = 0; i & 12; i++){
for (j = 0; j & 22; j++){
map[i][j] = 0;
public void drawwall(){
for (i = 0; i & 12; i++){
map[i][21] = 2;
for (j = 0; j & 22; j++){
map[11][j] = 2;
map[0][j] = 2;
// 旋转的方法
public void turn(){
int tempturnState = turnS
turnState = (turnState + 1) % 4;
if (!blow(x, y, blockType, turnState)){
if (blow(x, y, blockType, turnState)){
turnState = tempturnS
repaint();
// 左移的方法
public void left(){
if (!blow(x - 1, y, blockType, turnState)) {
x = x - 1;
repaint();
// 右移的方法
public void right(){
if (!blow(x + 1, y, blockType, turnState)){
x = x + 1;
repaint();
// 下落的方法
public void down(){
if (!blow(x, y + 1, blockType, turnState)){
y = y + 1;
if (blow(x, y + 1, blockType, turnState)){
add(x, y, blockType, turnState);
newblock();
delline();
repaint();
// 消行的方法
public void delline(){
int c = 0;
int i = 0;
//i用来确定本次消了几行
for (int b = 0; b & 22; b++){
for (int a = 0; a & 12; a++){
if (map[a][b] == 1){
c = c + 1;
if (c == 10) {
i = i + 1;
for (int d = d & 0; d--) {
for (int e = 0; e & 11; e++) {
map[e][d] = map[e][d - 1];
//确定消行分数
switch (i) {
score = score +10;
score = score +30;
score = score +60;
score = score +100;
if(score&=200*level){
level=level+1;
JOptionPane.showMessageDialog(null, "
恭喜过关");
drawwall();
// 把当前添加map
public void add(int x, int y, int blockType, int turnState) {
int j = 0;
for (int a = 0; a & 4; a++){
for (int b = 0; b & 4; b++){
if (map[x + b + 1][y + a] == 0){
map[x + b + 1][y + a] = shapes[blockType][turnState][j];
// 画方块的的方法
public void paintComponent(Graphics g){
//Object[] yanse = {"BLUE","GREEN","LIGHT_GRAY","YELLOW","PINK"};
super.paintComponent(g);
// 画当前方块
for (j=0;j&16;j++){
if (shapes[blockType][turnState][j]==1){
//画矩形区域
g.setColor(Color.BLUE);
g.fill3DRect((j%4+x+1)*20,(j/4+y)*20,20,20,true);
g.setColor(Color.BLACK);
g.draw3DRect((j%4+x+1)*20,(j/4+y)*20,20,20, true);
//画下一个方块
for (j = 0; j & 16; j++){
if (shapes[nextb][nextt][j] == 1){
g.setColor(Color.BLUE);
g.fill3DRect((j%4+1)*20+250,(j/4)*20+60, 20, 20,true);
g.setColor(Color.BLACK);
g.draw3DRect((j%4+1)*20+250,(j/4)*20+60, 20, 20, true);
// 画已经固定的方块
for (j = 0; j & 22; j++){
for (i = 0; i & 12; i++){
if (map[i][j]==2){ //画围墙
g.setColor(Color.BLACK);
g.fill3DRect(i*20,j*20,20,20,true);
g.setColor(Color.WHITE);
g.draw3DRect(i*20,j*20,20,20,true);
if (map[i][j]==1){ //画固定的方块
g.setColor(Color.GREEN);
g.fill3DRect(i*20,j*20,20,20,true);
g.setColor(Color.BLACK);
g.draw3DRect(i*20,j*20,20,20,true);
g.setColor(Color.black);
g.drawString("score = "+score,250,10);
g.drawString("level = "+level,250,30);
g.setColor(Color.RED);
g.drawString("下一个方块:",250,50);
// 键盘监听
public void keyPressed(KeyEvent e){
switch (e.getKeyCode()){
case KeyEvent.VK_DOWN:
case KeyEvent.VK_SPACE:
case KeyEvent.VK_RIGHT:
case KeyEvent.VK_LEFT:
//保留,以备升级用
public void keyReleased(KeyEvent e){
//保留,以备升级用
public void keyTyped(KeyEvent e){
// 定时器监听
class TimerListener implements ActionListener {
public void actionPerformed(ActionEvent e){
repaint();
if (!blow(x,y+1,blockType,turnState)){
delline();
if (blow(x, y+1, blockType,turnState)){
if (flag == true) {
add(x,y,blockType,turnState);
delline();
newblock();
登录百度帐号推荐应用
为兴趣而生,贴吧更懂你。或}

我要回帖

更多关于 数独求解算法 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信