USACO section1.1:
DONE 2017.03.03 TEXT Submitting Solutions
DONE 2017.03.04 PROB Your Ride Is Here [ANALYSIS]
DONE 2017.03.04 TEXT Contest Problem Types
DONE 2017.03.04 TEXT Ad Hoc Problems
DONE 2017.03.04 PROB Greedy Gift Givers [ANALYSIS]
DONE 2017.03.04 PROB Friday the Thirteenth [ANALYSIS]
DONE 2017.03.04 PROB Broken Necklace [ANALYSIS]
由上可见section1.1中共有四道题,没有考察算法,只是单纯看思考是否到位以及细心程度。
Prob1:Your Ride Is Here(水题)
题意:input给出两个全部由大写字母组成的单词, 每个字母对应一个数字(A-1,B-2……),两个单词中的字母分别相乘,得到两个数字, 判断这两个数字%47的余数是否相等。
NOTE:由于数据很小,无须担心溢出,但是保险起见,还是在每次运算的过程中取余。(a%b)*(c%b) = (a*c)%b;
源代码:
/*
ID:kongse_1
PROG:ride
LANG:C++
*/
#include
#include
#include
using namespace std;
const int MOD = 47;
string a, b;
int num1=1 ,num2=1;
int main()
{
freopen("ride.in", "r", stdin);
freopen("ride.out", "w", stdout);
cin >> a >> b;
for(int i = 0; i != a.size(); ++i)
num1