1445 A 求n个整数的和
  1564 B 判断一个数是否是完全数
  1011 C 判素数(Prime number)
  1566 D 输入一组整数,找出最小值
  1200 E 判断三角形是否为直角三角形
  1508 F 袋子里有多少个球(一般情况)
  1139 G 叙拉古猜想
  1135 H 阿姆斯特朗数(Armstrong number)
  1031 I 求阶乘和(the sum of Factorial)
  1402 J 数字根(Digital Roots)
  1567 K 拆分数字并从低位到高位输出
  1565 L 十进制数转二进制从低位到高位输出
Problem A
求n个整数的和
时限:1000ms 内存限制:10000K 总时限:3000ms
描述:

先输入一个正整数n,再输入n个整数,求它们的和。
输入:

先输入一个正整数n,再输入n个正整数,

输出:

输出它们的和

输入样例:

输出样例:

Problem A 求n个整数的和

#include <iostream>
using namespace std;

int main()
{
    int n;
    while(cin>>n)
    {
        ;
        int temp;
        ; i<n; i++)
        {
            cin>>temp;
            sum += temp;
        }
        cout<<sum<<endl;
    }

    ;
}

代码A

Problem B
判断一个数是否是完全数
时限:1000ms 内存限制:10000K 总时限:3000ms
描述:

如果一个大于2的整数的不包含它自身的约数之和恰好等于它本身,则称其为完全数。如:=++,所以,6是个完全数。
Perfect number is defined as follows:the sum of it’s common divisor which does not includes it’s maximum equals itself.

输入:

输入一个大于2的整数n,

输出:

编程判断n是不是完全数,如果是输出“Yes”,否则输出“No”。

输入样例:

输出样例:

Yes

Problem B 判断一个数是否是完全数

#include <iostream>
using namespace std;

int main()
{
    int n;
    while(cin>>n)
    {
        ;
        ; i<n; i++)
        {
            )
                sum += i;
        }
        if(sum == n)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }

    ;
}

代码B

Problem C
判素数(Prime number)
时限:100ms 内存限制:10000K 总时限:1000ms
描述:

给出一个数n(<=n<=),判定它是否为素数。
素数:一个大于等于2的数,除了1和它本身,再没有其他的整数能将其整除的数叫素数。
Input a number n(<=n<=), judge if it is a prime number.

输入:

从标准输入输入一个整数。
Input a number n(<=n<=)

输出:

若给定数为素数,向标准输出输出“Yes”,否则,输出“No”。
If the number is a prime, output “Yes”. Otherwise, output “No”.

输入样例:

输出样例:

Yes

Problem C 判素数(Prime number)

#include <iostream>
#include<stdio.h>
using namespace std;

int main()
{
    int n;

    while(cin>>n)
    {
        ;
        ; i<=n/; i++)
        {
            )
            {
                flag = ;
                break;
            }
        }
        if(flag)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }
    ;
}

代码C

 
Problem D
输入一组整数,找出最小值
时限:1000ms 内存限制:10000K 总时限:3000ms
描述:

先输入一个正整数n,然后输入n个整数,输出其最小值。

输入:

先输入一个正整数n,然后输入n个整数。

输出:

输出其最小值(最后输出一个回车)。

输入样例:

输出样例:

Problem D 输入一组整数,找出最小值

 #include <iostream>
 #include<stdio.h>
 using namespace std;

 int main()
 {
     int n;
     while(cin>>n)
     {
         ;
         int temp;
         ; i<n; ++i)
         {
             cin>>temp;
             if(temp <= min)
                 min = temp;
         }
         cout<<min<<endl;
     }
     ;
 }

代码D

Problem E
判断三角形是否为直角三角形
时限:100ms 内存限制:10000K 总时限:1000ms
描述:

给定平面直角坐标系中的三个点的坐标,判断是否能构成直角三角形。

输入:

三个点的坐标,数据都在-100000到100000之间。

输出:

一个整数,当可以构成直角三角形的时候输出1,否则输出0。

输入样例:

输出样例:

Problem E 判断三角形是否为直角三角形

 #include <iostream>
 #include<stdio.h>
 using namespace std;

 int main()
 {
     ];
     ; i<; i++)
     {
         cin>>p[i];
     }
     double a,b,c;
     a = (p[]-p[])*(p[]-p[]) + (p[]-p[])*(p[]-p[]);
     b = (p[]-p[])*(p[]-p[]) + (p[]-p[])*(p[]-p[]);
     c = (p[]-p[])*(p[]-p[]) + (p[]-p[])*(p[]-p[]);
     if(a+b==c || a+c==b || b+c == a)
         cout<<<<endl;
     else
         cout<<<<endl;

     ;
 }

代码E

Problem F
袋子里有多少个球(一般情况)
时限:1000ms 内存限制:10000K 总时限:3000ms
描述:

袋子里有若干个球的问题,聪明的佳佳很快就算出来了,但是他想写一个程序解决这个问题,并想把问题扩展到一般情况:每次拿出其中的一半再放回去一个球,一共这样做了n次,袋子里还有m个球。问原来袋子中有多少个球?

输入:

输入两个正整数n和m,

输出:

袋子里原来有多少个球

输入样例:

输出样例:

Problem F 袋子里有多少个球(一般情况)

 #include <iostream>
 #include<stdio.h>
 using namespace std;

 int main()
 {

     int n, m;
     cin>>n;
     cin>>m;
     ; i<n; i++)
     {
         m = (m-) * ;
     }
     cout<<m<<endl;
     ;
 }

代码F

Problem G
叙拉古猜想
时限:1000ms 内存限制:10000K 总时限:3000ms
描述:

叙拉古猜想又称科拉兹猜想、哈塞猜想、3n+1猜想、乌拉姆猜想或角谷猜想,是指对于每一个大于1的正整数,如果它是奇数,则将其乘3加1,如果它是偶数,则将除以2,如此循环,最终将得到1。
Syracuse conjecture also known  conjecture the Ulam conjecture or angle Valley conjecture, means ,  and plus1, , and so on, will eventually give .

输入:

输入数据包含一个整数N(<N<=)。
Input a positive integer.

输出:

输出数据包含从这个整数到1的按照叙拉古猜想变换的序列,每行一个数字。
Output the sequence in accordance with the Syracuse guess, one per line figures.

输入样例:

输出样例:

Problem G 叙拉古猜想

 #include <iostream>
 #include<stdio.h>
 using namespace std;

 int main()
 {

     int N;
     while(cin>>N)
     {
         cout<<N<<endl;
         )
         {
              == )
                 N /= ;
             else
                 N = N* + ;
             cout<<N<<endl;
         }
     }
 }

代码G

Problem H
阿姆斯特朗数(Armstrong number)
时限:1000ms 内存限制:10000K 总时限:1000ms
描述:

阿姆斯特朗数又称水仙花数,是指一种三位数,其各个数字之立方和等于该数。
Armstrong number which is also called Daffodils number is a three-figure number,and the sum of the number of it’s respective positions equals itself.
For example  = ** + ** + ** 

输入:

本题无输入
None

输出:

升序输出所有阿姆斯特朗数,每个数字占一行。
Output all Armstrong number in ascending order and every integer occupies a line only.

输入样例:

无None
输出样例:

无None

Problem H 阿姆斯特朗数(Armstrong number)

 #include <iostream>
 #include<stdio.h>
 #include<math.h>
 using namespace std;

 int main()
 {
     int a,b,c;
     ; i<; i++)
     {
         a = i/;
         b = (i-a*) / ;
         c = i-a*-b*;
         if(i == a*a*a + b*b*b + c*c*c)
             cout<<i<<endl;
     }
 }

代码H

Problem I
求阶乘和(the sum of Factorial)
时限:1000ms 内存限制:10000K 总时限:3000ms
描述:

给你一个正整数n,请你求1到n的阶乘的和,并输出最后结果
如给你5 , 即计算 !+!+!+!+!
Input a positive integer n,and calculate the sum of n!.For example,n  and calculate the following formula:
!+!+!+!+!

输入:

一个正整数n
a positive integer n.

输出:

求得的阶乘和
The sum of n!

输入样例:

输出样例:

Problem I 求阶乘和(the sum of Factorial)

 #include <iostream>
 using namespace std;

 int main()
 {
     int n;
     while(cin>>n)
     {
         ;
         int temp;
         ; i<=n; i++)
         {
             temp = ;
             ; j<=i; j++)
                 temp *= j;
             sum += temp;
         }
         cout<<sum<<endl;
     }
 }

代码I

Problem J
数字根(Digital Roots)
时限:1000ms 内存限制:10000K 总时限:3000ms
描述:

一个正整数的数字根是指该数字各位数字之和,如果和是一个个位数,那么这个数字就是它的数字根,如果和是个两位或多于两位的数字,那么就继续求和直到得到个位数。
例如:数字24,把2和4相加,得到6,那么6就是24的数字根;又比如数字39,把数字3和9相加,得到12,因为12时是两位数,所以继续把1和2相加,得到3,于是3就是39的数字根。
The digital root of a positive integer is found by summing the digits of the integer. If the resulting value is a single digit then that digit is the digital root. If the resulting value contains two or more digits, those digits are summed and the process is repeated. This is continued as long as necessary to obtain a single digit.
For example, consider the positive integer . Adding the  and the  yields a value of . Since   . Now consider the positive integer . Adding the  and the  yields . Since   and the  yeilds , a single digit and also the digital root of .

输入:

输入一个正整数,
input a positive integer,

输出:

输出它的数字根。
Output its digital root.

输入样例:

输出样例:

Problem J 数字根(Digital Roots)

 #include <iostream>
 using namespace std;

 int main()
 {
     int n;
     while(cin>>n)
     {
         int temp;
         ;
         while(n)
         {
             temp = n%;
             n /= ;
             sum += temp;
         }
         )
             cout<<sum<<endl;
         else
         {
             int temp2,temp3;
             )
             {
                 temp2 = sum;
                 sum = ;
                 while(temp2)
                 {
                     temp3 = temp2%;
                     temp2 /= ;
                     sum += temp3;
                 }
             }
             cout<<sum<<endl;
         }
     }
 }

代码J

Problem K
拆分数字并从低位到高位输出
时限:1000ms 内存限制:10000K 总时限:3000ms
描述:

输入一个正整数,将其各个位上的数字按从低位到高位的顺序单独输出,每个数字占一行。提示可用两种除法/和%,用于整数时第一种除法的结果是商的整数部分,第二种除法的结果是余数,例如:/=,%=)

输入:

一个正整数。

输出:

将其各个位上的数字按从低位到高位的顺序单独输出,每个数字占一行。

输入样例:

输出样例:

Problem K 拆分数字并从低位到高位输出

 #include <iostream>
 using namespace std;
 void swap(int *p,int *p2);
 int main()
 {
     int n;
     ];
     while(cin>>n)
     {
         ;
         while(n)
         {
             num[i] = n % ;
             n /= ;
             i++;
         }
         ; j<i; j++)
         {
             cout<<num[j]<<endl;
         }
     }
 }

代码K

Problem L
十进制数转二进制从低位到高位输出
时限:1000ms 内存限制:10000K 总时限:3000ms
描述:

输入一个十进制数,把它转成二进制数后,从低位到高位输出。

输入:

一个十进制数n。

输出:

把n转化为二进制数以后,从地位到高位输出(每个数字占一行)。

输入样例:

输出样例:

Problem L 十进制数转二进制从低位到高位输出

 #include <iostream>
 using namespace std;
 void swap(int *p,int *p2);
 int main()
 {
     int n;
     while(cin>>n)
     {
         ];
         ;
         while(n)
         {
             b[i] = n % ;
             n /= ;
             i++;
         }
         ; j<i; j++)
         {
             cout<<b[j]<<endl;
         }
     }
 }

代码L

Noj - 在线强化训练1的更多相关文章

  1. Noj - 在线强化训练3

    状态 题号 竞赛题号 标题   1091 A 求解逆波兰表达式(Calculate the reverse Polish notation)   1017 B 数列   1323 C 穷举n位二进制数 ...

  2. Noj - 在线强化训练4

    状态 题号 竞赛题号 标题 × 1092 A 童年的回忆——计算24 × 1145 B 求图像的周长 × 1144 C 农场灌溉问题 × 1202 D 数独游戏 × 1243 E 循环赛日程表 × 1 ...

  3. Noj - 在线强化训练2

    状态 题号 竞赛题号 标题   1572 A 九鼎之尊(一)   1573 B 九鼎之尊(二)   1453 C 筛法(Sieve Method)   1134 D 亲密数(close numbers ...

  4. Hinton胶囊网络后最新研究:用“在线蒸馏”训练大规模分布式神经网络

    Hinton胶囊网络后最新研究:用“在线蒸馏”训练大规模分布式神经网络 朱晓霞发表于目标检测和深度学习订阅 457 广告关闭 11.11 智慧上云 云服务器企业新用户优先购,享双11同等价格 立即抢购 ...

  5. Android:JNI强化训练

    一.前言 Java本机接口(Java Native Interface (JNI))是本机编程接口,它是JDK的一部分,JNI它提供了若干的API,实现了和Java和其他通信(主要是C&C++ ...

  6. Python强化训练笔记(七)——使用deque队列以及将对象保存为文件

    collections模块中的deque对象是一个队列,它有着正常队列的先进先出原则.我们可以利用这个对象来实现数据的保存功能. 例如,现有一个猜数字大小的游戏,系统开始会随机roll点一个0-100 ...

  7. Python强化训练笔记(六)——让字典保持有序性

    python的字典是一个非常方便的数据结构,使用它我们可以轻易的根据姓名(键)来找到他的成绩,排名等(值),而不用去遍历整个数据集. 例如:{'Lee': [1, 100], 'Jane': [2, ...

  8. Python强化训练笔记(五)——找出多个字典中的公共键

    在这个问题中,我们期望得到的结果是找到这三轮比赛中,每轮都进球的球员都有谁.下面用python来模拟一下,先生成一批数据: >>> from random import randin ...

  9. ACM: 强化训练-Beautiful People-最长递增子序列变形-DP

    199. Beautiful People time limit per test: 0.25 sec. memory limit per test: 65536 KB input: standard ...

随机推荐

  1. LuoGu P2735 电网 Electric Fences

    题目传送门 这个东西,本来我是用求出两条一次函数解析式然后判断在x坐标下的y坐标值来做的 首先因为没考虑钝角三角形,WA了 然后又因为精度处理不好又WA了 一气之下,只能去网上查了查那个皮克定理 首先 ...

  2. 鼠标hover图片时遮罩层匀速上升显示内容top、定位

    1.html <div class="div1">   <div class="div11">   <p >Dolor nu ...

  3. vue v-show绑定

    在Vue中使用v-show指令来选择性的显示内容.它的属性值可以是布尔值.属性名称以及函数名称.如果使用函数来控制的话,无论函数内容如何运算判断,最终返回布尔值true或者false就可以了 < ...

  4. 纯CSS3轮播图

    <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...

  5. C# 通用数据库配置界面,微软原生DLL重整合

    C# 通用数据库配置界面,微软原生DLL重整合 自己整合了 微软自带的数据连接配置界面对话库    Microsoft.Data.ConnectionUI.Dialog.dll  微软自带的数据连接配 ...

  6. Oracle 行转列pivot 、列转行unpivot 的Sql语句总结

    这个比较简单,用||或concat函数可以实现 select concat(id,username) str from app_user select id||username str from ap ...

  7. Confluence 6 从一个 XML 备份中导入一个空间

    有下面 2 中方法可以导入一个空间——通过上传一个文件,或者从你 Confluence 服务器上的一个目录中导入.上传文件仅仅是针对一个小站点的情况.为了取得最好的导入结果,我们推荐你从服务器上的目录 ...

  8. algorithm的基本注意事项

    find(): 返还指向该迭代器的指针,找不到返还last:lnlt find(lnlt first,lnlt last ,const T&val);范围[first,last); list: ...

  9. Solver Of Caffe

    本文旨在解决如何编写solver文件. Solver的流程: 1.     设计好需要优化的对象,以及用于学习的训练网络和用于评估的测试网络.(通过调用另外一个配置文件prototxt来进行) 2.  ...

  10. Python初探list

    今天要说一个新概念--list,中文可以翻译成列表,是用来处理一组有序项目的数据结构.想象一下你的购物清单.待办工作.手机通讯录等等,它们都可以看作是一个列表.说它是新概念也不算确切,因为我们之前已经 ...