今天终于注册了USACO的账号,进入后发现这个OJ非常的神奇。所以特意在这篇文章中了解一下(本文以第一题作为例题讲解这个神奇OJ的不同之处)

先看一下注册的地方,这几个是必须要填的,第一行填邮箱(建议是sina邮箱),后面写名字和昵称(并不重要,因为之后它会发给你),填入验证码,计算这个方程的正根。

后面这些东西随便填不填。

点击submit,就会发邮件到你填入的邮箱里。告诉你UserName和Password。

填入上面的框框中就进入网站了,但之后可以在网站上方6个蓝色条第一列最后一条Change Password改成自己心仪的密码方便记忆哦。

下图就是网站主页了。中间的表格就是一道道题目,必须把一个Section解决才能进入下一个Section。我们看到标题前有TEXT就是文章,看完就可以了,PROB就是需要做的题目。标题前会有标记和完成日期。DONE表示已完成,VIEWED表示正在进行中,TODO表示还没有做过。左边一栏NEWS中的第一条就是USACO的Contest(比赛)啦,有兴趣的人可以自己去打一打。

进入题目!!!正式看到USACO的神奇之处。

首先,是必须要选择文件上交!

这很正常,但是它还规定了文件名,要把文件输入输出写出来。

例如第一题要求你文件名ride。

你要建一个文件,输入输出写好。

然后就是最重要的地方,我们需要在程序的最上方加入三行。第一行ID就是你自己的UserName。第二行就是语言(其中C++11和C++14都是最新版的)。第三行是它给定的题目名。

其实这一些在第一篇TEXT Submitting Solutions中都有写到,只是我觉得它写得不太易懂,故作此文。

那么接下来正式看看第一题好了。

Your Ride Is Here

It is a well-known fact that behind every good comet is a UFO. These UFOs often come to collect loyal supporters from here on Earth. Unfortunately, they only have room to pick up one group of followers on each trip. They do, however, let the groups know ahead of time which will be picked up for each comet by a clever scheme: they pick a name for the comet which, along with the name of the group, can be used to determine if it is a particular group's turn to go (who do you think names the comets?). The details of the matching scheme are given below; your job is to write a program which takes the names of a group and a comet and then determines whether the group should go with the UFO behind that comet.

Both the name of the group and the name of the comet are converted into a number in the following manner: the final number is just the product of all the letters in the name, where "A" is 1 and "Z" is 26. For instance, the group "USACO" would be 21 * 19 * 1 * 3 * 15 = 17955. If the group's number mod 47 is the same as the comet's number mod 47, then you need to tell the group to get ready! (Remember that "a mod b" is the remainder left over after dividing a by b; 34 mod 10 is 4.)

Write a program which reads in the name of the comet and the name of the group and figures out whether according to the above scheme the names are a match, printing "GO" if they match and "STAY" if not. The names of the groups and the comets will be a string of capital letters with no spaces or punctuation, up to 6 characters long.

Examples:

Input Output
COMETQ
HVNGAT
GO
ABSTAR
USACO 
STAY

PROGRAM NAME: ride

This means that you fill in your header with:
PROG: ride 
WARNING: You must have 'ride' in this field or the wrong test data (or no test data) will be used.

INPUT FORMAT

Line 1: An upper case character string of length 1..6 that is the name of the comet.
Line 2: An upper case character string of length 1..6 that is the name of the group.

NOTE: The input file has a newline at the end of each line but does not have a "return". Sometimes, programmers code for the Windows paradigm of "return" followed by "newline"; don't do that! Use simple input routines like "readln" (for Pascal) and, for C/C++, "fscanf" and "fid>>string".

NOTE 2: Because of the extra characters, be sure to leave enough room for a 'newline' (also notated as '\n') and an end of string character ('\0') if your language uses it (as C and C++ do). This means you need eight characters of room instead of six.

SAMPLE INPUT (file ride.in)

COMETQ
HVNGAT

OUTPUT FORMAT

A single line containing either the word "GO" or the word "STAY".

SAMPLE OUTPUT (file ride.out)

GO

OUTPUT EXPLANATION

Converting the letters to numbers:

C O M E T Q  
3 15 13 5 20 17  
H V N G A T
8 22 14 7 1 20  

then calculate the product mod 47:

3 * 15 * 13 * 5 * 20 * 17 = 994500 mod 47 = 27
8 * 22 * 14 * 7 *  1 * 20 = 344960 mod 47 = 27

Because both products evaluate to 27 (when modded by 47), the mission is 'GO'.

Submit a solution:
   

Training Gateway  |   Comment or Question

题意比较简单,两个单词,根据题意将每个单词分别转化为数字,如果两个数字对47取模相同输出“GO”,否则输出“STAY”。直接模拟。

Code:

/*
ID:jackora1
LANG:C++
TASK:ride
*/
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#define N 1005
using namespace std;
char a[N],b[N];
int main()
{freopen("ride.in","r",stdin);freopen("ride.out","w",stdout);scanf("%s%s",a,b);long long ans1=1,ans2=1;for(int i=0;i<strlen(a);i++)ans1*=(long long)a[i]-'A'+1;for(int i=0;i<strlen(b);i++)ans2*=(long long)b[i]-'A'+1;if((ans1%47)==(ans2%47))puts("GO");else puts("STAY");return 0;
}

在你A了一道题后,它会给你题解(ANALYSIS)。但这似乎没什么用。

好了,关于USACO的讲解就结束了。Thank you all!

详解USACO这个神奇的OJ相关推荐

  1. 详解JavaScript之神奇的Object.defineProperty

    摘要: JavaScript有个很神奇的Object.defineProperty(),了解一下? =与Object.defineProperty 为JavaScript对象新增或者修改属性,有两种不 ...

  2. 【typescript】断言签名与谓词签名!详解ts中神奇的asserts与is

    前言 最初发现有这玩意是在styledcomponents的声明中,很神奇的写了个is. 后来翻阅官方文档后发现,除了is是谓词签名外,还有assert断言签名. 官方文档 对于这种东西讲解,最好的方 ...

  3. 【数据结构与算法】详解 “清华大学(考研)OJ题”_ 二叉树重要面试OJ题

  4. php动态+trait,详解PHP神奇又有用的Trait

    php和java,c++一样都是单继承模式.但是像python,是支持多继承(即Mixin模式).那么如何在php中实现多继承模式?这就需要使用trait. trait Arrayabletrait{ ...

  5. 对于刷oj时因为scanf()出现wa而cin却AC的详解 【scanf() 和 cin 详解】

    故事还得从昨天讲起,昨天做了一道题及其的诡异,用cin输入AC了.用scanf()却一直的报错或者陷入了 死循环.这让我很费解,我用了fflush(stdin)来排除,发现没有效果.后来我想起之前写过 ...

  6. git config设置用户名_一个神奇的工具,实现多人协作,git常用命令详解

    git是一款开源的分布式版本控制工具,在世界上所有分布式版本控制工具中,git是最快.最简单.最流行的. git的作者是Linux之父:Linus Benedict Torvalds,当初开发git仅 ...

  7. HTTP协议详解(真的很经典)

    转自:http://blog.csdn.net/gueter/archive/2007/03/08/1524447.aspx Author :Jeffrey 引言 HTTP是一个属于应用层的面向对象的 ...

  8. [转]HTTP协议详解

    当今web程序的开发技术真是百家争鸣,ASP.NET, PHP, JSP,Perl, AJAX 等等. 无论Web技术在未来如何发展,理解Web程序之间通信的基本协议相当重要, 因为它让我们理解了We ...

  9. float属性html,详解CSS样式中的float属性

    详解CSS样式中的float属性.float是 css 样式的定位属性.我们在印刷排版中,文本可以按照需要围绕图片.一般把这种方式称为"文本环绕".在网页设计中,应用了CSS的fl ...

最新文章

  1. CentOS 7.x自定义开机启动设置
  2. python能表示多大整数_Python无法表示99999999999999999999这样大的整数。
  3. 【转知乎】人工智能会是泡沫吗?
  4. 消防信号二总线有没电压_消防的电源总线和二总线的区别,二总线是不是信号..._消防考试_帮考网...
  5. matlab求图形的聚类系数,求助,为什么画不出来聚类系数的图?一直为0啊
  6. 【Java面试宝典】深入理解JAVA虚拟机
  7. 静态链接库与动态链接库的区别(Sqlite\Visual Studio 2017)
  8. RabbitMQ—AMQP协议重要概念介绍
  9. BZOJ 1609 [Usaco2008 Feb]Eating Together麻烦的聚餐:LIS LDS (nlogn)
  10. pthread_key_create
  11. 在服务器客户端怎么启用协议,如何启用客户机的WINS功能
  12. 收集几个AS3频谱代码SoundMixer.ComputeSpectrum()
  13. python的三种数据类型列举_3.Python编程之数据类型
  14. python异常 Exception
  15. php 1970毫秒数,php – date()返回1970-01-01
  16. 使用Python实现电子词典
  17. 冒泡排序(java)——3种方法
  18. 转专业2017武汉大学计算机学,武大,10届考生谈谈转专业~`~
  19. java小球挡板游戏_多线程的一个小球游戏,就是以前的那个Pong游戏
  20. 西部狂徒自建服务器,在《西部狂徒》中如何快速建立自己根据地?杀人放火是上策...

热门文章

  1. FlowLayoutPanel内的控件调换顺序
  2. DVWA之PHP文件上传漏洞(File Upload)
  3. 【区块链】Python开发EOS机器人与WAX链游脚本常用工具
  4. aoc显示器开机显示计算机,_求各路大神帮忙解决,配置如下 电脑开机AOC显示器显示无信号,每次都要重新拔了再插才有画面_...
  5. IntelliJ IDEA 安装使用教程以及激活码
  6. C语言内存讲解-详说内存分布和heap空间
  7. 优云实名认证_玩无人机要实名登记了,你支持吗?优云UBOX代飞100小时
  8. IT隔离电源系统在医院供配电的应用探讨
  9. java计算机毕业设计ssm泸定中学宿舍管理系统设计g93gd(附源码、数据库)
  10. 【计算机视觉】数字图像处理(二)—— 图像数字化特征介绍