2017下半年ACM-ICPC网络赛签到题汇总
来源:互联网 发布:nginx 查看模块 编辑:程序博客网 时间:2024/04/27 10:00
青岛站
Problem Description
A cubic number is the result of using a whole number in a multiplication three times. For example, 3×3×3=27 so 27 is a cubic number. The first few cubic numbers are 1,8,27,64 and 125. Given an prime number p. Check that if p is a difference of two cubic numbers.
Input
The first of input contains an integer T (1≤T≤100) which is the total number of test cases.
For each test case, a line contains a prime number p (2≤p≤1012).
Output
For each test case, output ‘YES’ if given p is a difference of two cubic numbers, or ‘NO’ if not.
#include <stdio.h>#include <math.h>int main(){ int t; scanf("%d", &t); while(t--){ long long p; scanf("%I64d", &p); p -=1; long long n = floor(sqrt(p/3)); if(p == 3*n*(n+1)){ printf("YES\n"); }else { printf("NO\n"); } } return 0;}
Chinese Zodiac
Problem Description
The Chinese Zodiac, known as Sheng Xiao, is based on a twelve-year cycle, each year in the cycle related to an animal sign. These signs are the rat, ox, tiger, rabbit, dragon, snake, horse, sheep, monkey, rooster, dog and pig.
Victoria is married to a younger man, but no one knows the real age difference between the couple. The good news is that she told us their Chinese Zodiac signs. Their years of birth in luner calendar is not the same. Here we can guess a very rough estimate of the minimum age difference between them.
If, for instance, the signs of Victoria and her husband are ox and rabbit respectively, the estimate should be 2 years. But if the signs of the couple is the same, the answer should be 12 years.
Input
The first line of input contains an integer T (1≤T≤1000) indicating the number of test cases.
For each test case a line of two strings describes the signs of Victoria and her husband.
Output
For each test case output an integer in a line.
Sample Input
3
ox rooster
rooster ox
dragon dragon
Sample Output
8
4
12
#include <stdio.h>#include <string.h>int shengXiao(char a[8] ){ int n; if(strcmp(a, "rat")==0){ n = 12; }else if(strcmp(a, "ox")==0){ n = 11; }else if(strcmp(a,"tiger")==0){ n = 10; }else if(strcmp(a, "rabbit")==0){ n = 9; }else if(strcmp(a, "dragon")==0){ n = 8; }else if(strcmp(a, "snake")==0) n = 7; else if(strcmp(a,"horse")==0) n = 6; else if(strcmp(a,"sheep")==0) n = 5; else if(strcmp(a,"monkey")==0) n = 4; else if(strcmp(a, "rooster")==0) n = 3; else if(strcmp(a,"dog")==0) n = 2; else if(strcmp(a, "pig")==0) n = 1; return n;}int main(){ int t; scanf("%d", &t); while(t--){ char z[8],w[8]; scanf("%s%s", &z, &w); int n = shengXiao(z); int m = shengXiao(w); int s = n-m; if(s <= 0){ s += 12; } printf("%d\n", s); } }
- 2017下半年ACM-ICPC网络赛签到题汇总
- 2017 ACM-ICPC 亚洲区(乌鲁木齐赛区)网络赛 A. Banana(签到)
- 2017 ACM-ICPC 亚洲区(乌鲁木齐赛区)网络赛 C. Coconut(签到)
- HDU-2017 ACM/ICPC Asia Regional Shenyang Online-签到题
- 2014 ACM/ICPC 牡丹江赛区网络赛解题报告汇总
- 2014 ACM/ICPC 西安赛区网络赛解题报告汇总
- 2014 ACM/ICPC 广州赛区网络赛解题报告汇总
- 2014 ACM/ICPC 北京赛区网络赛解题报告汇总
- 2014 ACM/ICPC 上海赛区网络赛解题报告汇总
- ACM-ICPC国际大学生程序设计竞赛北京赛区(2017)网络赛 题解汇总 Territorial Dispute
- 2017 ACM-ICPC 网络赛 总结
- HDU5078 2014 ACM-ICPC亚洲区域赛鞍山赛区现场赛I题 Osu! 签到题
- ZOJ3819 ACM-ICPC 2014 亚洲区域赛牡丹江赛区现场赛A题 Average Score 签到题
- 2017 ACM-ICPC 沈阳赛(网络赛)
- 2017 ACM-ICPC 亚洲区乌鲁木齐赛网络赛 E
- 2017 ACM-ICPC 亚洲区(乌鲁木齐赛区)网络赛
- 2017 ACM-ICPC 亚洲区(乌鲁木齐赛区)网络赛
- 2017 ACM-ICPC 亚洲区(乌鲁木齐赛区)网络赛
- Gauge中文文档(10)—故障处理
- IIS与IIC
- imageLoader框架
- Java基础集合类(二):LinkedList详解
- 不爱说话?社交无能?或许你可以试试这种说话术
- 2017下半年ACM-ICPC网络赛签到题汇总
- 带头节点的双链表及其基本操作(Java实现)
- PTA 7-7(排序) Windows消息队列(25 分) 25分代码 优先队列
- windows查看某个端口被谁占用
- 嵌入式视频处理基础(二)
- 编程珠玑--啊哈!算法
- POJ2096 Collecting Bugs (概率DP)
- XListView请求网络数据
- jsp中编码的设置