edge.cc.txt

来自「Ulm大学2003-2004年竞赛题」· 文本 代码 · 共 42 行

TXT
42
字号
// Problem   Edge// Algorithm Straight-Forward// Runtime   O(n)// Author    Walter Guttmann// Date      05.01.2003#include <complex>#include <fstream>#include <iostream>#include <string>using namespace std;typedef complex<double> comp;ifstream in ("edge.in");int main (){  string s;  while (in >> s)  {    cout << "300 420 moveto" << endl;    cout << "310 420 lineto" << endl;    comp pos(310, 420), d(10, 0);    for (string::iterator it = s.begin() ; it != s.end() ; ++it)    {      switch (*it)      {        case 'A': pos += (d *= comp(0, -1)); break;        case 'V': pos += (d *= comp(0, 1)); break;        default: throw;      }      cout << pos.real() << " " << pos.imag() << " lineto" << endl;    }    cout << "stroke" << endl;    cout << "showpage" << endl;  }  return 0;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?