Submission #649738
Source Code Expand
#include <iostream> #include <vector> using namespace std; int tt[10000]={0}; int fill(int a, int b){ for(int i=a; i<b; i++){ tt[i] = 1; } } int s(int x){ int n = x - (x/10)*10; if(n>5) n=n-5; return x-n; } int g(int x){ int n = x - (x/10)*10; // out << "x:" << x << " n:" << n << endl; if(n>5){ x+=(10-n); }else{ x+=(5-n); } return x; } int main(void) { int n; cin >> n; vector <int> a; vector <int> b; vector <int> c; vector <int> d; for(int i=0; i<n; i++){ char t; int t1,t2; cin >> t1 >> t >> t2; a.push_back(t1); b.push_back(t2); } for(int i=0; i<n; i++){ a[i] = s(a[i]); b[i] = g(b[i]); } for(int i=0; i<n; i++){ // cout << a[i] << "-" << b[i] << endl; fill(a[i],b[i]); } bool flag=true; for(int i=0; i<10000; i++){ if(tt[i]==1&&flag==true){ printf("%4.0d-",i); flag=false; } if(tt[i]==0&&flag==false){ printf("%4.0d\n",i); flag=true; } } }
Submission Info
Submission Time | |
---|---|
Task | D - 感雨時刻の整理 |
User | chiwakii |
Language | C++ (G++ 4.6.4) |
Score | 0 |
Code Size | 982 Byte |
Status | CE |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:54:21: error: ‘printf’ was not declared in this scope ./Main.cpp:58:22: error: ‘printf’ was not declared in this scope