C语言趣味程序百例精解之JAVA实现(56)区分旅客国籍

国籍选择的插件 Android、PHP、Java、、、注册中 国籍选择的插件 、官方正品 立即下载
 C语言趣味程序百例精解之JAVA实现(56)区分旅客国籍




程序:

public class Test56{
   public static void main(String args[]){
      new Test56().whereAreYouFrom56();
   }

   /**  
     * 56。区分旅客国籍  
     *  
     * 1美国,2德国,3英国,4法国,5俄罗斯,6意大利  
     */  
    public void whereAreYouFrom56() {  
        int count = 0;  
        for (int a = 1; a <= 6; a++)  
            for (int b = 1; b <= 6; b++)  
                for (int c = 1; c <= 6; c++)  
                    for (int d = 1; d <= 6; d++)  
                        for (int e = 1; e <= 6; e++)  
                            for (int f = 1; f <= 6; f++)  
                                if (a != 1  
                                        && a != 5  
                                        && a != 2  
                                        && e != 1  
                                        && e != 2  
                                        && e != 5  
                                        && c != 2  
                                        && c != 1  
                                        && c != 5  
                                        && b != 2  
                                        && f != 2  
                                        && a != 4  
                                        && c != 6  
                                        && b != 1  
                                        && c != 4  
                                        && notEquls(new int[] { a, b, c, d, e,  
                                                f })) {  
                                    count++;  
                                    System.out.print(" a=" + a);  
                                    System.out.print(" b=" + b);  
                                    System.out.print(" c=" + c);  
                                    System.out.print(" d=" + d);  
                                    System.out.print(" e=" + e);  
                                    System.out.println(" f=" + f);  
                                }  
        System.out.println("Count =" + count);  
    }  
   /**  
     * 判断是否两两不相等  
     */  
    public boolean notEquls(int[] a) {  
        if (a == null || a.length == 0 || a.length == 1)  
            return true;  
        for (int i = 0; i < a.length; i++) {  
            for (int j = 0; j < a.length; j++) {  
                if (a == a[j] && i != j) {  
                    // System.out.println("a[" + i + "]" + a + " a[" + j +  
                    // "]"  
                    // + a[j] + "---");  
                    return false;  
                }  
            }  
        }  
        return true;  
    }  
}
C:\bat>java   Test56
a=6 b=5 c=3 d=2 e=4 f=1
Count =1
a是意大利人,B是俄罗斯人,c是英国人,D是德国人,E是法国人,F是美国人。

转载自: http://www.javaxxz.com/read.php?tid=2048
国籍代码大全 国别国籍代码大全,比较全的国籍代码大全excel文件。可以下载导入到数据库中。 立即下载

相关推荐

旅客国籍问题

在一个旅馆中住着六个不同国籍的人,他们分别来自美国、德国、英国、法国、俄罗斯、意大利。他们的名字叫A、B、C、D、E和F。(名字的顺序与上面的国籍不一定是互相答对应得)现在已知条件如下: 1)A和美国人是医生; 2)E和俄罗斯人是教师; 3)C和德国人是技师; 4)B和F曾经当过兵,而德国人从未惨过军; 5)法国人的年龄比A大,意大利人的年龄比C大; 6)B同美国人下周要去西安旅行,而C同法国人下周要去杭州度假。

获取全世界所有国家的中文名称和英文名称

获取全世界所有国家的中文名称和英文名称

fantasyfzg的博客 1759

nationality国籍选择插件(带国籍三字码)

用于类似于携程网站的注册页面上的国籍选择插件,使用方便,配置简单,国家数量齐全,可用于在注册页面,用户信息填写页面

java 根据ip获取国籍_为评论者添加国籍、操作系统、浏览器和IP信息显示

1、下载:show-useragent(显示国籍系统浏览器文件))和 ip2c(显示运营商IP信息文件)2、上传并解压到WordPress主题目录(解压后得到show-useragent文件夹和ip2c文件夹)3、将show-useragent和ip2c引入到主题:将以下代码放到主题目录下的functions.php中include("ip2c/ip2c.php");//IP归属地和运营商查询功能...

weixin_34817716的博客 369

国别国籍代码大全

国别国籍代码大全

全球国家字典表(有代码)

全球国家字典表(有代码),整理后文档,适用于字典表

在一个旅馆中住着六个不同国籍的人,他们分别来自美国、德国、英国、法国、俄罗斯和意大利。他们的名字叫A、B、C、D、E和F。名字的顺序与上面的国籍不一定是相互对应的。现在已知:   1)A美国人是医生。...

1 #include<stdio.h> 2   char *m[7]={" ","U.S","U.K","FRANCE","GER","ITALI","EUSSIAN"}; /*国名*/ 3   int main() 4   { 5   int a[7][7],i,j,t,e,x,y; 6   for(i=0;i<7;i++) /*初始化条件矩阵*/...

weixin_34179762的博客 1840

全局子程序 参数调用

为什么要子程序: 为了实现程序结构化,我们尽量使用不同功能的功能块来实现一些特定的功能, 子程序接口: 使用过程的注意事项,尤其是数组使用时的注意事项 从一个主程序中可以将参数传递到局部或全局子程序和函数中。 怎样传递参数有 2 种方式: 作为 IN 参数 变量值在主程序中保持不变。 这种传递方式也称为“ 值传递 (Call by Value)”。 作为 OUT 参数 子程序读取并更改该值,然后将新值写回到主程序中。 这种传递方式也称为“Call by Reference”。 举例说明 1 DEF MY

Eric_Yang1024的博客 1095

趣味编程——区分旅客国籍

在一个宾馆里住这六个不同国籍的人,他们分别来自美国,德国,英国,法国,俄罗斯和意大利。他们的名字叫A,B,C,D,E,F。名字的顺序与上面的国籍不一定相互对应。

MaZhongkai1994的博客 1440

Triton推理服务器实战:如何为PaddleOCR的ONNX模型配置动态批处理和并发推理

本文详细介绍了如何使用Triton推理服务器为PaddleOCR的ONNX模型配置动态批处理和并发推理,以提升GPU利用率和推理性能。通过实战案例和参数调优指南,帮助开发者解决高并发场景下的性能瓶颈问题,实现从实验室到生产环境的高效部署。

weixin_42527160的博客 426

从Mate到Mate40 Pro+:华为旗舰核心配置演进与选购避坑指南

本文回顾了华为Mate系列从初代到Mate40 Pro+的核心配置演进历程,重点分析了处理器性能、影像系统、屏幕设计及续航快充的技术突破。针对选购需求,提供了区分版本、5G选择及存储配置的实用避坑建议,帮助消费者明智选择华为旗舰机型。

weixin_30015371的博客 494

(百例趣味编程题)56、区分旅客国籍

题目:在一个旅馆中住着六个不同国籍的人,他们分别来自美国、德国、英国、法国、俄罗斯和意大利。他们的名字叫A、B、C、D、E和F。名字的顺序与上面的国籍不一定是相互对应的。现在已知: 1)A美国人是医生。 2)E和俄罗斯人是教师。 3)C和德国人是技师。 4)B和F曾经当过兵,而德国人从未参过军。 5)法国人比A年龄大;意大利人比C年龄大。 6)B同美国人下周要去西安旅行,而C同

nigulasi_dawei的博客 1301

基于555定时器的呼吸灯电路

呼吸灯是指LED灯在芯片的控制下完成由亮到暗的逐渐变化,感觉就像人在呼吸,其广泛使用在手机上,起到一个通知提醒的作用。呼吸灯在许多灯光装饰上也有大量使用,如音响、汽车广告牌等,在生活中较为常见。...

qq1074237849的博客 9496

java,56个民族enum

56个民族enum package com.bj58.finance.moneybox.richesuser.provider.enums; public enum NationalityEnum { HAN("01", "汉族"), MONGOL("02","蒙古族"), HUI("03","回族"), TIBETAN("04","藏族"), UYGHU...

zona_wzq的博客 2321

(学习笔记)机器人自主导航从零开始第四步———Rviz、Gazebo、Meshlab的安装

一、Rviz的安装 Rviz是一个

qq_59475883的博客 5057

凝聚态物理新引擎:AI 驱动材料预测与相变识别大突破

摘要:本文深入探讨 AI 在凝聚态物理中的创新应用。在材料性质预测方面,AI 借助数据收集、特征提取和模型训练,能依据材料微观信息准确预估其宏观性质,以石墨烯为例验证了高效性。对于拓扑相变识别,AI 通过分析量子力学数据,利用机器学习算法判别相变节点,助力拓扑绝缘体研究。尽管面临数据质量、模型可解释性等挑战,但未来多模态数据融合、可解释 AI 等发展方向,将推动 AI 与凝聚态物理深度融合,助力探索物质奥秘与新材料研发。

专注于人工智能、软件开发、工控自动化、工厂数字化及智能化等领域,希望和大家共同进步! 1828

推理题:有六个不同国籍的人,他们的名字分别为A,B,C,D....

有六个不同国籍的人,他们的名字分别为A,B,C,D,E和F;他们的国籍分别是美国、德国、英国、法国、俄罗斯和意大利(名字顺序与国籍顺序不一定一致) 现已知: (1)A和美国人是医生; (2)E和俄罗斯人是教师; (3)C和德国人是技师; (4)B和F曾经当过兵,而德国人从没当过兵; (5)法国人比A年龄大,意大利人比C年龄大; (6)B同美国人下周要到英国去旅行,C同法...

weixin_30478619的博客 1262

《信息化项目文档模板十二——业务需求新增/变更审批确认表 》

系列文章目录 《信息化项目文档模板一——项目需求说明书》 《信息化项目文档模板二——项目启动会文档模板》 《信息化项目文档模板三——会议纪要模板》 《信息化项目文档模板四——系统项目蓝图设计模板》 《信息化项目文档模板五——系统详细设计模板》 《信息化项目文档模板六——系统详细设计模板》 《信息化项目文档模板七——系统开发计划模板》 《信息化项目文档模板八——系统功能测试模板》 《信息化项目文档模板九——系统压力测试模板》 《信息化项目文档模板十——系统推广上线计划模板》 《信息化项目文档模板十一——系统用

商务合作|问题讨论|交流学习 请联系作者微信,加微信请务必注明来意,博客主页有联系方式 1712

国籍库,省市库

今天做项目,需要后台传输全球所有的国家名称和我国的省市数据来做字典库, 原想着是建立一个表,就是用来装载数据,后来一想,建立库之后要对它进行造操作,一系列的后台方法就要加入,最麻烦的是要导入数据, 国家数和我过的省市数,想想就头大了,还是在网上找现成的js库比较靠谱,这不就找到了,写在这里用来备份。 国家库:http://www.codeweblog.com/jquery-javascrip

sjk_wt的博客 3644

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

关于java的一些趣味编程题的实现(1)阿姆斯特朗数

问555555的约数中最大的三位数是多少?  package 阿姆斯特朗数;public class ArmstrongNumber { public static void main(String[] args) {  int j,k,l;  for(int i=10;i  {   if(i   {    j=i/10;    k=i%10;    if(j*j*j+k*k*k=

peiandsky的专栏 2237

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

InnoDB 内存结构总览:Change Buffer、AHI 与 Log Buffer

本文系统梳理InnoDB内存结构中的ChangeBuffer、Adaptive Hash Index(AHI)与LogBuffer。ChangeBuffer缓存二级索引页不在内存时的变更,减少随机IO,仅在页加载时合并;聚簇索引修改立即执行,因数据本身不可延后。AHI基于高频等值查询自动构建哈希索引,加速定位,仅支持等值操作。LogBuffer为redo log内存缓冲,配合磁盘日志实现崩溃恢复。三者均服务于性能优化,其中ChangeBuffer与AHI共享BufferPool空间,而LogBuffer独立

bksczm的博客 293

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

上一篇: C语言趣味程序百例精解之JAVA实现(46)列最简真分数
下一篇: C语言趣味程序百例精解之JAVA实现(83):卡布列克常数
dearbaba2011
博客等级 码龄15年 1粉丝 5原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值