Divided Land

Divided Land

Time Limit: 8000/4000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 1540    Accepted Submission(s): 657


Problem Description
It’s time to fight the local despots and redistribute the land. There is a rectangular piece of land granted from the government, whose length and width are both in binary form. As the mayor, you must segment the land into multiple squares of equal size for the villagers. What are required is there must be no any waste and each single segmented square land has as large area as possible. The width of the segmented square land is also binary.
 

Input
The first line of the input is T (1 ≤ T ≤ 100), which stands for the number of test cases you need to solve.

Each case contains two binary number represents the length L and the width W of given land. (0 < L, W ≤ 2 1000)
 

Output
For each test case, print a line “Case #t: ”(without quotes, t means the index of the test case) at the beginning. Then one number means the largest width of land that can be divided from input data. And it will be show in binary. Do not have any useless number or space.
 

Sample Input
  
  
3 10 100 100 110 10010 1100
 

Sample Output
  
  
Case #1: 10 Case #2: 10 Case #3: 110
这道题题意是给一个长方形的长和宽,并且长和宽是二进制表示的,把这个长方形分成小正方形,要求不浪费,并且尽可能大,1,不浪费的话说明正好宽和长都可以尽可能分完
所以是长和宽的公因数,2.尽可能大,所以题意就很明显了,找最大公因数,并且二进制形式输出出来。因为是大数还设计二进制转换,所以用java中的BigInteger。
因为第一次用编译错误了两次,mian函数外面的公共类要用Main才行。。。。
import java.math.BigInteger;//导入大数包
import java.util.Scanner;//导入输入包
public class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
        Scanner sc = new Scanner(System.in);
        int t;
        BigInteger A;
        BigInteger B;//定义两个大数
        t = sc.nextInt();//读入样例个数
        for(int i = 1; i <= t; i++) {
        	A = sc.nextBigInteger(2);
        	B = sc.nextBigInteger(2);//以2进制读入大数
        	System.out.print("Case #" + i + ": ");
        	System.out.println(A.gcd(B).toString(2));//以二进制输出gcd
        }
        
	}

}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
# CNN_UCMerced-LandUse_Caffe(数据:http://vision.ucmerced.edu/datasets/landuse.html) 主要任务:基于深度学习框架完成对光学遥感图像UCMerced LandUse数据集的分类。 数据特点:共包含21类土地类型图片,每类100张,每张像素大小为256*256,数据类内距离大,类间小。 完成情况:数据量太小,训练数据出现过拟合;为了克服这个问题,又减小训练时间,采用caffe框架,在别人训练好的bvlc_reference_caffenwt模型上进行fine-tune,对最后一层设置较大的学习速率,结果取得了93%的正确率;在这基础上又在fc7层上提取了每张图片的4096维特征,进行了SVM分类,取得了95%以上的分类正确率,并对结果做了可视化分析。 环境:ubuntu14.04 + caffe + python(数据划分和增强在用windows10的3.5,其余都是unbuntu下用的2.7) 程序(相关路径需要修改)/步骤: multi_divide_pic.py---多进程进行数据划分(cv2没装成功,建议用cv2,方便) multi_augmentation_pic.py---多进程数据增强 make_caffe_lmdb.py---生成caffe训练需要的数据路径文件,然后修改caffe配置文件 bvlc_reference_caffenet.caffemodel---caffe模型,在上面进行finetune(http://dl.caffe.berkeleyvision.org/?from=message&isappinstalled=1) binaryproto2npy.py---将caffe生成的均值文件转换成.npy格式 cnn_vision_caffe.py---对训练好的模型进行可视化分析 extract_features.py---获取每张图片在fc7层输出的4096维特征 svm_predict.py---使用svm对上述提取的特征进行训练预测 svm_vision.py---对svm模型进行可视化分析 tsne.py---对数据进行降维可视化
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值