#303

by asd

Submitted 3 years 6 months 1 day ago
Mon May 10 19:12:30 CST 2021
Judger: judger1
Dataset Version: v1

0 ms / 0 KB
Final 0
Problem: lss4.dandelion
Language: GNU C++ 11


#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <deque>
#include <bits/stdc++.h>
//#include "testlib.h"
using namespace std;
#define ll long long
#define pii pair<int,int>
#define qi ios::sync_with_stdio(0)

bool debug=true;

/*    *************************************
	  * Written in New Computer           *
	  * The following code belongs to     *
	  * XiaoGeNintendo of HellHoleStudios *
	  *************************************
*/
template<typename T1,typename T2>ostream& operator<<(ostream& os,pair<T1,T2> ptt){
	os<<ptt.first<<","<<ptt.second;
	return os;
}
template<typename T>ostream& operator<<(ostream& os,vector<T> vt){
	os<<"{";
	for(int i=0;i<vt.size();i++){
		os<<vt[i]<<" ";
	}
	os<<"}";
	return os;
}

int main(){
	string n;
	while(cin>>n){
	    if(n>=2){
	        n=n[n.size()-2]+n[n.size()-1]
	    }
		if(n=="11" || n=="12" || n=="13" || n=="14"){
			cout<<n<<"th"<<endl;
			continue;
		}
		char c=n.back();
		if(c=='1'){
			cout<<n<<"st"<<endl;
		}else if(c=='2'){
			cout<<n<<"nd"<<endl;
		}else if(c=='3'){
			cout<<n<<"rd"<<endl;
		}else{
			cout<<n<<"th"<<endl;
		}
	}	
}
Compilation Error:
Main.cpp: In function ‘int main()’:
Main.cpp:42:10: error: no match for ‘operator>=’ (operand types are ‘std::__cxx11::string {aka std::__cxx11::basic_string<char>}’ and ‘int’)
      if(n>=2){
         ~^~~
In file included from /usr/include/c++/7/regex:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110,
                 from Main.cpp:11:
/usr/include/c++/7/bits/regex.h:1026:5: note: candidate: template<class _BiIter> bool std::__cxx11::operator>=(const std::__cxx11::sub_match<_BiIter>&, const std::__cxx11::sub_match<_BiIter>&)
     operator>=(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
     ^~~~~~~~
/usr/include/c++/7/bits/regex.h:1026:5: note:   template argument deduction/substitution failed:
Main.cpp:42:12: note:   ‘std::__cxx11::string {aka std::__cxx11::basic_string<char>}’ is not derived from ‘const std::__cxx11::sub_match<_BiIter>’
      if(n>=2){
            ^
In file included from /usr/include/c++/7/regex:62:0,
                 from /usr/include<...>