codeforces 712B Memory and Trident
作者:互联网
2019-05-19
11:33:45
加油!!!坚持
昨天只做了两道题,但是学了一下DFS和c++
做了一下微信小游戏的UI,和游戏文档策划
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { string s; cin >> s; ll i, j; ll u = 0; ll d = 0; ll r = 0; ll l = 0; if (s.length()&1) { cout << -1; return 0; } for(i = 0; i < s.length(); i++) { if(s[i] == 'U') { u++; } else if(s[i] == 'D') { d++; } else if(s[i] == 'L') { l++; } else { r++; } } ll x = abs(u - d); ll y = abs(r - l); cout << (x + y) / 2; return 0; }
标签:typedef,cout,int,ll,Trident,712B,codeforces,long,Memory 来源: https://www.cnblogs.com/Artimis-fightting/p/10888627.html