gdufe acm 1138 出题人这样不好吧
来源:互联网 发布:中国海关统计数据库 编辑:程序博客网 时间:2024/04/30 09:55
链接:http://acm.gdufe.edu.cn/Problem/read/id/1138
Problem Description:
作为编协的第一次月赛,肯定是要有防AK(ALL KILL)的题目的,只会Fibnacci数的出题人绞尽脑汁,没能想出一道难题,没办法只好在题面上做一些手脚(加密)。
其中有一道题题面是这样的:
hjxhs ia dvwpude z,he sn f snrzad deppahe, tbcm wytj ir sm zvdpzdxiq uus tjc ta n dijphqer rclu taw yl p.
比赛时,XX神对题面研究了两个多小时,终于找到一点点规律,破解出了前4个单词hjxhs ia dvwpude z,是given an integer n。但是比赛的时间已经不多了,XX神需要你的帮助。请帮他解密题面,并帮他ac了这个题。
Input:
输入包含多组数据(EOF)。对于每组数据,输入一个数字n(1<=n<=100000);
Output:
对于每组数据,输出答案。
Sample Input:
1
Sample Output:
1
先算出:
hjxhs ia dvwpude z 和 given an integer n ,各字母ascil值减’a’,
进行对比:
7 9 23 7 18 8 0 3 21 22 15 20 3 4 25
6 8 21 4 13 0 13 8 13 19 4 6 4 17 13
突破口是题干中“只会Fibnacci数的出题人”,
刚好上面两行数字对应着减下来是:
1 1 2 3 5 8 13…
解密后其实就是:“given an integer n,it is a simple problem, your task is to calculate the sum of n integers from one to n.”
(算斐波那契数列时要取余26)
AC代码其实就几行:
#include <cstdio>int main(){ int n; while(scanf("%d", &n) == 1){ long long ans = 1LL*(1 + n)*n/2; printf("%lld\n", ans); } return 0;}
- gdufe acm 1138 出题人这样不好吧
- gdufe acm 1206 lowbit
- gdufe acm 1057 leftmost digit
- gdufe acm 1086 互质数
- gdufe acm 1121 Fibonacci数
- gdufe acm 1054 变形课
- gdufe acm 1363 校庆嘉宾
- gdufe acm 1361 校庆抽奖
- gdufe acm 1359 校庆素数
- gdufe acm 1107 Apple Collection
- 拓扑排序 gdufe acm 1183
- gdufe acm 1178 拼接数字
- gdufe acm 1014 Scramble Sort
- 这样可不好吧?
- gdufe acm 1136 查找ACM(加强版)
- gdufe acm 1228 a*b-c
- gdufe acm 1011 Prime Ring Problem
- gdufe acm 1068 Tempter of the Bone
- shrink_inactive_list
- JSON.NET VS BinaryFormatter 性能
- shrink_list
- ajax参数传递之[HttpGet]/[HttpPost]/[HttpPut]/[HttpDelete]请求
- 寂寞
- gdufe acm 1138 出题人这样不好吧
- MyBatis代码生成工具mybatis-generator在Myeclipse10中的使用
- iOS coretext框架第一章 基础知识
- 从今天开始,拼命把自己锻炼成一个软件人才,立此博以铭志
- Objective-C MVC MVVM MVP
- java工具,框架等的历史版本下载页面
- js中的正则表达式入门
- java NIO基础知识
- POJ3281 Dining