今天终于注册了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. 使 WebBrowser 更简单的新加和执行 js, 可安装 jQuery 脚本的 C# 开源代码 - IEBrowser [1]...
  2. 通过学历造假获得面试机会,并成功拿到 Offer,这样的操作你认可吗?
  3. ubuntu+VsCode+Cmake+eigen 开发eigen应用
  4. Problem - 6111迷宫出逃
  5. 把旧系统迁移到.Net Core 2.0 日记(2) - 依赖注入/日志NLog
  6. 河南理工大学计算机专业几本,2018河南理工大学是几本 是一本还是二本
  7. My PaintBrush Pro for mac(专业的绘图画板)
  8. 施乐s2110进入维修模式,富士施乐s2110恢复出厂
  9. 数据结构试卷及答案(五)
  10. 基于微信小程序的人脸识别
  11. 【linux学习】yum提示 :Another app is currently holding the yum lock; waiting for it to exit...
  12. 简单易懂!推荐给自学python的小项目实战!
  13. abcd选项后的数据分析_引入新的数据abcs
  14. 棕榈油跌停见顶,铁矿石认沽上涨,YP05惊天大反弹2022.3.14
  15. halcon在图片上画几何形状并保存
  16. 百度地图 雷达/地理编码 功能使用
  17. 实战HttpClient 接口调用以及获取token 设置请求头
  18. vue实现 修改密码
  19. android安全问题(八)伪造短信(利用原生android4.0漏洞)
  20. 我的世界服务器整人系列,我的世界:整人还在用TNT?老玩家用这7个道具简直谁见谁怕!...

热门文章

  1. postfix 反垃圾邮件中使用 RBL
  2. SAP OData 开发从入门到提高教程的目录
  3. Python heap
  4. 爬虫1——(爬虫3days课程)
  5. RadioButton 单选
  6. 2018年的经历有苦有甜
  7. linux系统制作裸设备,在unix下和linux下创建裸设备总结
  8. 基于区块链的车联网汽车管理系统
  9. 如何有效地学习空中英语,彭蒙惠英语
  10. ROOK 使用cephfs后状态为Warn的解决办法