随笔分类 -  Arithmetic

1 2 3 下一页
算法。
Console-算法:fun1(do while)
摘要:ylbtech-Arithmetic:Console-算法[do while]-XX1.A,Demo(案例)1.B,Solution(解决方案)using System;namespace ConsoleApplication1{ class Program { /// /// ylb: do while /// /// static void Main(string[] args) { Console.Write(fun(2.5)); } /... 阅读全文
posted @ 2014-03-26 10:17 ylbtech 阅读(469) 评论(0) 推荐(0) 编辑
Console-算法[for,if]-不用第三个变量,交换两字符串的值
摘要:ylbtech-Arithmetic:Console-算法[for,if]-不用第三个变量,交换两字符串的值1.A,Demo(案例)Console-算法[for,if]-不用第三个变量,交换两字符串的值1.B,Solution(解决方案)using System;namespace ConsoleApplication1{ class Program { /// /// ylb:算法 /// 不用第三个变量,交换两字符串的值 /// /// static void Main(string[] ... 阅读全文
posted @ 2013-06-07 22:03 ylbtech 阅读(463) 评论(0) 推荐(0) 编辑
Console-算法[]-数组求最大值和最小值(只能遍历一次)
摘要:ylbtech-Arithmetic:Console-算法[]-数组求最大值和最小值(只能遍历一次)1.A,Demo(案例)Console-算法[]-数组求最大值和最小值(只能遍历一次)1.B,Solution(解决方案)1.B.1, 方法一using System;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { int[] arrayList = new int[] {2,4,1,6,3,6,9,8 }; ... 阅读全文
posted @ 2013-06-02 08:35 ylbtech 阅读(727) 评论(0) 推荐(0) 编辑
Console-算法[if,Function]-一用递归的方式代替循环语句
摘要:ylbtech-Arithmetic:Console-算法[if,Function]-一用递归的方式代替循环语句1.A,Demo(案例)用递归的方式代替循环语句1.B,Solution(解决方案)1.B.1,方式一using System;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { int i = 0; int length = 10; Write(i,length); ... 阅读全文
posted @ 2013-06-02 08:02 ylbtech 阅读(343) 评论(0) 推荐(0) 编辑
Console-算法-某个公司采用公用电话传递数据,数据是四位的整数,在传递过程中是加密的
摘要:ylbtech-Arithmetic:Console-算法-某个公司采用公用电话传递数据,数据是四位的整数,在传递过程中是加密的1.A,Demo(案例)【程序89】题目:某个公司采用公用电话传递数据,数据是四位的整数,在传递过程中是加密的,加密规则如下: 每位数字都加上5,然后用和除以10的余数代替该数字,再将第一位和第四位交换,第二位和第三位交换。1.程序分析:1.B,Solution(解决方案)using System;namespace ConsoleApplication1{ class Program { static void Main(string[... 阅读全文
posted @ 2013-05-08 10:08 ylbtech 阅读(6245) 评论(1) 推荐(0) 编辑
Console-算法[for,while,dowhile]-读取7个数(1—50)的整数值,每读取一个值,程序打印出该值个数的*
摘要:ylbtech-Arithmetic:Console-算法[for,while,dowhile]-读取7个数(1—50)的整数值,每读取一个值,程序打印出该值个数的*1.A,Demo(案例)【程序88】题目:读取7个数(1—50)的整数值,每读取一个值,程序打印出该值个数的*。1.程序分析:1.B,Solution(解决方案)using System;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { int i, a, n... 阅读全文
posted @ 2013-05-08 09:54 ylbtech 阅读(2887) 评论(0) 推荐(0) 编辑
Console-算法-一个偶数总能表示为两个素数之和
摘要:ylbtech-Arithmetic:Console-算法-一个偶数总能表示为两个素数之和1.A,Demo(案例)【程序84】题目:一个偶数总能表示为两个素数之和。1.程序分析:1.B,Solution(解决方案)【不太理解】using System;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { int a, b, c, d; a = Convert.ToInt32(Console.ReadLin... 阅读全文
posted @ 2013-05-07 17:52 ylbtech 阅读(681) 评论(0) 推荐(0) 编辑
Console-算法-求0—7所能组成的奇数个数
摘要:ylbtech-Arithmetic:Console-算法-求0—7所能组成的奇数个数1.A,Demo(案例)【程序83】题目:求0—7所能组成的奇数个数。1.程序分析:1.B,Solution(解决方案) 【不是明白是如何构思的】using System;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { long sum = 4, s = 4; int j; for (j = ... 阅读全文
posted @ 2013-05-07 17:41 ylbtech 阅读(403) 评论(0) 推荐(0) 编辑
Console-Un-算法-809*??=800*??+9*??+1
摘要:ylbtech-Arithmetic:Console-算法-809*??=800*??+9*??+11.A,Demo(案例)【程序81】题目:809*??=800*??+9*??+1 其中??代表的两位数,8*??的结果为两位数,9*??的结果为3位数。求??代表的两位数,及809*??后的结果。1.程序分析:1.B,Solution(解决方案)1.B.1,C语言output(long b,long i){ printf("\n%ld/%ld=809*%ld+%ld",b,i,i,b%i);}main(){long int a,b,i;a=809;for(i=10;i< 阅读全文
posted @ 2013-05-07 17:21 ylbtech 阅读(565) 评论(0) 推荐(0) 编辑
Console-算法[for,if]-编写一个函数,输入n为偶数时,调用函数求1/2+1/4+...+1/n,
摘要:ylbtech-Arithmetic:Console-算法[for,if]-编写一个函数,输入n为偶数时,调用函数求1/2+1/4+...+1/n,1.A,Demo(案例)【程序76】题目:编写一个函数,输入n为偶数时,调用函数求1/2+1/4+...+1/n,当输入n为奇数时,调用函数 1/1+1/3+...+1/n(【利用指针函数】)1.程序分析:1.B,Solution(解决方案)using System;namespace ConsoleApplication1{ class Program { static float OuShu(int n) ... 阅读全文
posted @ 2013-05-07 16:51 ylbtech 阅读(2569) 评论(0) 推荐(0) 编辑
Console-算法[for]-打印出杨辉三角形
摘要:ylbtech-Arithmetic:Console-算法[for]-打印出杨辉三角形1.A,Demo(案例)【程序61】题目:打印出杨辉三角形(要求打印出10行如下图) 1.程序分析: 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 1.B,Solution(解决方案)using System;namespace ConsoleApplication1{ class Program { static void Main(string[]... 阅读全文
posted @ 2013-05-07 15:25 ylbtech 阅读(286) 评论(0) 推荐(0) 编辑
Console-算法[运算符]-学习使用按位取反~
摘要:ylbtech-Arithmetic:Console-算法[运算符]-学习使用按位取反~1.A,Demo(案例)【程序55】题目:学习使用按位取反~。 1.程序分析:~0=1; ~1=0;1.B,Solution(解决方案)using System;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { int a, b; a = 224; b = ~a; C... 阅读全文
posted @ 2013-05-07 14:35 ylbtech 阅读(295) 评论(0) 推荐(0) 编辑
Console-Un-算法[运算符]-取一个整数a从右端开始的4~7位
摘要:ylbtech-Arithmetic:Console-算法[运算符]-取一个整数a从右端开始的4~7位1.A,Demo(案例)【程序54】题目:取一个整数a从右端开始的4~7位。程序分析:可以这样考虑: (1)先使a右移4位。(2)设置一个低4位全为1,其余全为0的数。可用~(~0<<4)(3)将上面二者进行&运算。1.B,Solution(解决方案)1.B.1,C语言main(){unsigned a,b,c,d;scanf("%o",&a);b=a>>4;c=~(~0<<4);d=b&c;printf(&quo 阅读全文
posted @ 2013-05-07 10:10 ylbtech 阅读(569) 评论(0) 推荐(0) 编辑
Console-算法[运算符]-学习使用按位异或 ^
摘要:ylbtech-Arithmetic:Console-算法[运算符]-学习使用按位异或 ^1.A,Demo(案例)【程序53】题目:学习使用按位异或 ^ 。 1.程序分析:0^0=0; 0^1=1; 1^0=1; 1^1=01.B,Solution(解决方案)using System;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { int a, b; a = 077; b ... 阅读全文
posted @ 2013-05-07 09:53 ylbtech 阅读(317) 评论(0) 推荐(0) 编辑
Console-算法[运算符]-学习使用按位或 |
摘要:ylbtech-Arithmetic:Console-算法[运算符]-学习使用按位或 |1.A,Demo(案例)【程序52】题目:学习使用按位或 | 。1.程序分析:0|0=0; 0|1=1; 1|0=1; 1|1=11.B,Solution(解决方案)using System;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { int a, b; a = 077; b = a |... 阅读全文
posted @ 2013-05-07 09:50 ylbtech 阅读(272) 评论(0) 推荐(0) 编辑
Console-算法[运算符]-学习使用按位与 &
摘要:ylbtech-Arithmetic:Console-算法[运算符]-学习使用按位与 &1.A,Demo(案例)【程序51】题目:学习使用按位与 & 。 1.程序分析:0&0=0; 0&1=0; 1&0=0; 1&1=11.B,Solution(解决方案)using System;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { int a, b; a = 077; b = ... 阅读全文
posted @ 2013-05-07 09:45 ylbtech 阅读(286) 评论(0) 推荐(0) 编辑
Console-算法-回文数
摘要:ylbtech-Arithmetic:Console-算法-回文数1.A,Demo(案例)【程序30】 题目:一个5位数,判断它是不是回文数。即12321是回文数,个位与万位相同,十位与千位相同。 1.B,Solution(解决方案)using System;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { long wan, qian, shi, ge; Console.WriteLine("请输入... 阅读全文
posted @ 2013-05-06 17:06 ylbtech 阅读(194) 评论(0) 推荐(0) 编辑
Console-算法[for,if]-有5个人坐在一起,问第五个人多少岁?他说比第4个人大2岁。问第4个人岁数
摘要:ylbtech-Arithmetic:Console-算法[for,if]-有5个人坐在一起,问第五个人多少岁?他说比第4个人大2岁。问第4个人岁数1.A,Demo(案例)【程序28】 题目:有5个人坐在一起,问第五个人多少岁?他说比第4个人大2岁。问第4个人岁数,他说比第 3个人大2岁。问第三个人,又说比第2人大两岁。问第2个人,说比第一个人大两岁。最后 问第一个人,他说是10岁。请问第五个人多大?1.程序分析:利用递归的方法,递归分为回推和递推两个阶段。要想知道第五个人岁数,需知道 第四人的岁数,依次类推,推到第一人(10岁),再往回推。1.B,Solution(解决方... 阅读全文
posted @ 2013-05-06 16:47 ylbtech 阅读(4602) 评论(0) 推荐(0) 编辑
Console-算法-有一分数序列:2/1,3/2,5/3,8/5,13/8,21/13...求出这个数列的前20项之和
摘要:ylbtech-Arithmetic:Console-算法-有一分数序列:2/1,3/2,5/3,8/5,13/8,21/13...求出这个数列的前20项之和1.A,Demo(案例)【程序24】 题目:有一分数序列:2/1,3/2,5/3,8/5,13/8,21/13...求出这个数列的前20项之和。1.程序分析:请抓住分子与分母的变化规律。1.B,Solution(解决方案)1.B.1,方法一using System;namespace ConsoleApplication1{ class Program { static void Main(string[] ar... 阅读全文
posted @ 2013-05-06 16:33 ylbtech 阅读(1899) 评论(0) 推荐(0) 编辑
Console-算法[for,if]-一打印出如下图案(菱形)
摘要:ylbtech-Arithmetic:Console-算法[for,if]-一打印出如下图案(菱形)1.A,Demo(案例)【程序23】 题目:打印出如下图案(菱形) * ******************** *** *1.程序分析:先把图形分成两部分来看待,前四行一个规律,后三行一个规律,利用双重 for循环,第一层控制行,第二层控制列。1.B,Solution(解决方案)using System;namespace ConsoleApplication1{ class Program { static void Main(string[] args)... 阅读全文
posted @ 2013-05-06 15:58 ylbtech 阅读(577) 评论(0) 推荐(0) 编辑

1 2 3 下一页