E:Sudoku
总时间限制: 2000ms 内存限制: 65536kB
描述
Sudoku is a very simple task. A square table with 9 rows and 9 columns is divided to 9 smaller squares 3x3 as shown on the Figure. In some of the cells are written decimal digits from 1 to 9. The other cells are empty. The goal is to fill the empty cells with decimal digits from 1 to 9, one digit per cell, in such way that in each row, in each column and in each marked 3x3 subsquare, all the digits from 1 to 9 to appear. Write a program to solve a given Sudoku-task.
输入
The input data will start with the number of the test cases. For each test case, 9 lines follow, corresponding to the rows of the table. On each line a string of exactly 9 decimal digits is given, corresponding to the cells in this line. If a cell is empty it is represented by 0.
输出
For each test case your program should print the solution in the same format as the input data. The empty cells have to be filled according to the rules. If solutions is not unique, then the program may print any one of them.
样例输入
1
103000509
002109400
000704000
300502006
060000050
700803004
000401000
009205800
804000107
样例输出
143628579
572139468
986754231
391542786
468917352
725863914
237481695
619275843
854396127‘
E:Sudoku的更多相关文章
- Leetcode 笔记 36 - Sudoku Solver
题目链接:Sudoku Solver | LeetCode OJ Write a program to solve a Sudoku puzzle by filling the empty cells ...
- [LeetCode] Sudoku Solver 求解数独
Write a program to solve a Sudoku puzzle by filling the empty cells. Empty cells are indicated by th ...
- [LeetCode] Valid Sudoku 验证数独
Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules. The Sudoku board could be ...
- LeetCode 36 Valid Sudoku
Problem: Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules. The Sudoku board ...
- 【leetcode】Valid Sudoku
题目简述: Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules. The Sudoku board cou ...
- ACM : POJ 2676 SudoKu DFS - 数独
SudoKu Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%lld & %llu POJ 2676 Descr ...
- ACM: ICPC/CCPC Sudoku DFS - 数独
Sudoku Time Limit : 3000/1000ms (Java/Other) Memory Limit : 65535/65535K (Java/Other) Total Submis ...
- Leetcode: Sudoku Solver
July 19, 2015 Problem statement: Write a program to solve a Sudoku puzzle by filling the empty cells ...
- Leetcode Valid Sudoku
Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules. The Sudoku board could be ...
- Sudoku 数独游戏
#include<iostream> using namespace std; bool heng(int **sudo, int a, int b, int value) { bool ...
随机推荐
- TCP/IP网络编程中socket的行为
一. read/write的语义:为什么会阻塞? 先从write说起: #include <unistd.h>ssize_t write(int fd, const void *buf, ...
- broadcom代码中httpd进程启动流程介绍
Broadcom代码中包含WEB配置管理媒介, 在嵌入式WEB服务器min_httpd基础上改造实现, 其bin名称为httpd,此httpd可以由管理进程有连接后动态启动,并且当一段时间内没有连接到 ...
- 计划将项目中使用entity framework的要点记录到改栏目下
ef监控sql执行性能日志.http://www.cnblogs.com/CreateMyself/p/5277681.html http://123.122.205.38/cn_sql_server ...
- phpcms V9 MVC模式 与 URL访问解析
[1]URL访问解析 观察访问网页时的网址,可以得出模块访问方法,如下示例: http://www.abcd.com.cn/phpcms/index.php?m=content&c=index ...
- Objective-C语言多态性
动态类型和动态绑定,id可以表示任何指针类型,定义id变量不加* 多态性是指在父类中定义的成员变量和方法被子类继承之后,可以具有不同的数据类型或表现出不同的行为.这使得同一个变量和方法在父类及其各个子 ...
- 淘宝druid数据库连接池
昨天偶然间在@红薯的一篇技术分享中发现了它的身影,从此想到了去看看他到底是什么西,然后在@开源中国上看到了它的功能介绍,心痒难耐 开始了对它的配置测试. 但是第一次启动就发现了一个问题, Tomat报 ...
- O2O管理问题怎么解决?
O2O被认为是零售行业的最大变革.O2O模式凭着线上线下一体化融合,无差别的消费体验迅速拉拢了大批希望进军电商的传统零售企业,同时催生了大量以O2O为生的新兴企业.O2O是一种新的消费模式,给消费者带 ...
- [已解决] windows 80端口被占用
看下是不是IIS开着,如果是关掉就OK拉 原文地址:http://www.cnblogs.com/gifisan/p/5822156.html
- python基本数据类型之集合set
一.集合的定义 set集合,是一个无序且不重复的元素集合. 集合对象是一组无序排列的可哈希的值,集合成员可以做字典中的键.集合支持用in和not in操作符检查成员,由len()内建函数得到集合的基数 ...
- Android监听应用程序安装和卸载
Android监听应用程序安装和卸载 第一. 新建监听类:BootReceiver继承BroadcastReceiver package com.rongfzh.yc; import android. ...